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

@deepgram/docs-chat

v0.1.6

Published

Standalone AI chat widget for Deepgram docs

Readme

@deepgram/docs-chat

Standalone AI chat widget for Deepgram documentation sites. Drop it into any page to give users an instant "Ask AI" experience powered by Kapa.

Three modes from one init call — use whichever combination fits your page:

| Mode | What you get | |---|---| | Button + container | Inline chat on the page, button focuses it or opens sidebar fallback | | Button only | Button toggles a slide-in sidebar panel | | Container only | Chat mounts directly into the page, no button binding |

Both modes are SPA-aware and automatically re-bind when the DOM changes.

Install

pnpm add @deepgram/docs-chat

Quick start

Button + container (full experience)

Both a trigger button and an inline chat container. Clicking the button focuses the inline chat input if visible, otherwise opens the sidebar.

import { init } from '@deepgram/docs-chat';

init({
  integrationId: '<your-kapa-integration-id>',
  buttonId: 'ask-ai-btn',
  containerId: 'chat-container',
});

Button only (sidebar)

No inline chat. The button toggles a slide-in sidebar panel.

init({
  integrationId: '<your-kapa-integration-id>',
  buttonId: 'ask-ai-btn',
});

Container only (inline)

No button binding. The chat mounts directly into the container element.

init({
  integrationId: '<your-kapa-integration-id>',
  containerId: 'chat-container',
});

UMD (script tag)

<script src="https://unpkg.com/@deepgram/docs-chat"></script>
<script>
  DeepgramDocsChat.init({
    integrationId: '<your-kapa-integration-id>',
    buttonId: 'ask-ai-btn',
    containerId: 'chat-container',
  });
</script>

Configuration

init(config) accepts a ChatConfig object:

| Property | Type | Required | Description | |---|---|---|---| | integrationId | string | yes | Your Kapa AI integration ID | | buttonId | string | no* | DOM element ID for the "Ask AI" button | | containerId | string | no* | DOM element ID for the inline chat container |

* At least one of buttonId or containerId must be provided.

How it works

  1. If containerId is set and the element exists, the chat UI mounts inside it (inline mode).
  2. If buttonId is set, a sidebar panel is prepared (lazy-mounted on first open) and the button is bound:
    • If inline chat is visible — clicking the button focuses the chat input
    • Otherwise — clicking toggles the sidebar open/closed
  3. A MutationObserver watches for SPA navigation, re-binding the button and re-mounting inline chat when the DOM changes.

The button uses a document-level capture listener to intercept clicks before React 18+'s root-level event delegation, preventing framework routers (e.g. Next.js) from navigating away.

Theming

Widget styles are a self-contained subset of @deepgram/styles — no extra stylesheet needed. CSS is injected at runtime by the bundle.

The widget respects color-scheme on the <html> element, so toggling between light and dark works out of the box. To override colours, set --color-dg-* custom properties on your page.

Development

pnpm install       # install dependencies
pnpm dev           # vite dev server
pnpm build         # production build -> dist/
pnpm check         # lint + typecheck + test

Project structure

src/
  index.ts          Entry point, exports init() with config validation
  types.ts          ChatConfig interface
  orchestrator.ts   Init flow that wires all modules together
  chat-app.tsx      React chat UI component (messages, input, feedback)
  inline.tsx        Inline chat mount/unmount into a container element
  sidebar.tsx       Slide-in sidebar panel with lazy React mount
  button.ts         Ask AI button binding (document-level capture listener)
  dom-observer.ts   MutationObserver for SPA navigation re-binding
  icons.tsx         Inline SVG icon components (replaces FontAwesome dependency)
  styles.css        Self-contained styles (@deepgram/styles subset + chat layout)

Build output

Two bundles with CSS injected at runtime (via vite-plugin-css-injected-by-js):

  • dist/deepgram-docs-chat.es.js — ESM
  • dist/deepgram-docs-chat.umd.js — UMD (exposes DeepgramDocsChat global)

License

MIT