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

@meltingspot/widget

v1.0.0

Published

MeltingSpot Widget SDK

Readme

Widget SDK

Embed a MeltingSpot Widget into your own web application: inline, as a modal, or as a drawer.

Installation

Via <script> (CDN)

The standalone bundle is self-contained: it exposes window.MeltingSpot.Widget and injects its styles automatically (no separate stylesheet to load).

<script
  crossorigin
  src="https://cdn.jsdelivr.net/npm/@meltingspot/widget"
></script>

Via npm

npm install @meltingspot/widget
import { Widget } from '@meltingspot/widget';
import '@meltingspot/widget/stylesheet.css';

Authentication (authToken)

authToken is the current user's MeltingSpot SSO token. Provide it to render the widget as an authenticated member; omit it to show only public content to an anonymous visitor. Activate SSO on your spot to obtain these tokens.

Rendering modes

The SDK offers three ways to render a widget, depending on how much control you want:

| Mode | Methods | Behaviour | | ---------- | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | Inline | injectWidgetInto | Renders the widget immediately inside a container element you provide. Always visible, part of the layout. | | Modal | bindWidgetModalTo / createWidgetModal | Renders the widget in a centered overlay opened on demand. bind* wires it to a trigger; create* returns a handle you open/close yourself. | | Drawer | bindWidgetDrawerTo / createWidgetDrawer | Renders the widget in a side panel sliding from the left or right. Same bind* vs create* distinction. |

bind* methods attach the open behaviour to an existing element (e.g. a button), with zero extra wiring. create* methods return a Modal / Drawer instance with .open() / .close() so you drive visibility from your own code.

Inline

<div id="meltingspot-widget" style="width: 100%; height: 100%"></div>
<script>
  window.addEventListener('DOMContentLoaded', function () {
    window.MeltingSpot.Widget.injectWidgetInto('meltingspot-widget', {
      spotId: 'YOUR_SPOT_ID',
      widgetId: 'YOUR_WIDGET_ID',
      authToken: 'CURRENT_USER_SSO_TOKEN', // optional: omit for public content
      themeMode: 'auto',
    });
  });
</script>

Modal (bound to a trigger)

<button id="open-widget-modal" type="button">Open</button>
<script>
  window.addEventListener('DOMContentLoaded', function () {
    window.MeltingSpot.Widget.bindWidgetModalTo('open-widget-modal', {
      spotId: 'YOUR_SPOT_ID',
      widgetId: 'YOUR_WIDGET_ID',
      authToken: 'OPTIONAL_SSO_TOKEN',
      themeMode: 'auto',
    });
  });
</script>

Drawer (bound to a trigger)

<button id="open-widget-drawer" type="button">Open</button>
<script>
  window.addEventListener('DOMContentLoaded', function () {
    window.MeltingSpot.Widget.bindWidgetDrawerTo('open-widget-drawer', {
      position: 'right', // 'left' | 'right' (required)
      spotId: 'YOUR_SPOT_ID',
      widgetId: 'YOUR_WIDGET_ID',
      authToken: 'OPTIONAL_SSO_TOKEN',
      themeMode: 'auto',
    });
  });
</script>

Programmatic modal / drawer (create*)

When you need to open or close the widget from your own logic, create a handle:

import { Widget } from '@meltingspot/widget';

const drawer = Widget.createWidgetDrawer({
  spotId: 'YOUR_SPOT_ID',
  widgetId: 'YOUR_WIDGET_ID',
  authToken: 'OPTIONAL_SSO_TOKEN',
});

drawer.open(); // slide in
drawer.close(); // slide out

// Same API for a modal:
const modal = Widget.createWidgetModal({
  spotId: 'YOUR_SPOT_ID',
  widgetId: 'YOUR_WIDGET_ID',
});
modal.open();

Parameters

Common (all methods)

Fields of the options object (the last argument of every method).

| Option | Type | Required | Default | Description | | --------------- | ----------------------------------------- | -------- | --------------------------------- | ----------------------------------------------------------------------------------------- | | spotId | string | Yes* | n/a | Target spot id. *Optional on inject*/bind* if set via config; required on create*. | | widgetId | string | Yes | n/a | Target widget id. | | authToken | string | No | none (public content) | Current user's MeltingSpot SSO token. | | themeMode | 'auto' \| 'system' \| 'light' \| 'dark' | No | 'auto' | Force a theme. | | domain | string | No | none (default MeltingSpot domain) | Custom domain key of your spot. See domain. | | utmParameters | UtmParameters | No | parsed from the page URL params | UTM params appended to the widget URL. | | rootDocument | Document | No | current document | Document to inject into. |

Method-specific

Each method takes a positional target argument followed by the options object. The tables below list the positional target and the method-specific options.* fields; the common fields above apply to every method's options.

injectWidgetInto(target, options)

| Parameter | Type | Required | Default | Description | | --------- | ------------------- | -------- | ------- | -------------------------------------- | | target | string \| Element | Yes | n/a | Container the widget is rendered into. |

bindWidgetModalTo(target, options)

| Parameter | Type | Required | Default | Description | | -------------- | ------------------- | -------- | --------------- | ------------------------------------ | | target | string \| Element | Yes | n/a | Element whose click opens the modal. | | options.into | string \| Element | No | document.body | Where the modal mounts. |

bindWidgetDrawerTo(target, options)

| Parameter | Type | Required | Default | Description | | ------------------ | ------------------- | -------- | --------------- | ------------------------------------- | | target | string \| Element | Yes | n/a | Element whose click opens the drawer. | | options.position | 'left' \| 'right' | Yes | n/a | Side the drawer slides from. | | options.into | string \| Element | No | document.body | Where the drawer mounts. |

createWidgetModal(options) / createWidgetDrawer(options)

No method-specific parameters: they take the common options only and return a handle with .open() / .close().

domain

The custom domain key of your spot. It is forwarded to the widget so the internal links it generates point to your custom domain instead of the default MeltingSpot one.

See the "Multi-domains" section of the embed guide for details.

UtmParameters

Appended to the widget URL as utm_* query params (source becomes utm_source, etc.).

| Field | Type | Required | Default | Description | | ---------- | -------- | -------- | ------- | --------------------- | | source | string | Yes | n/a | utm_source value. | | medium | string | No | unset | utm_medium value. | | campaign | string | No | unset | utm_campaign value. | | term | string | No | unset | utm_term value. | | content | string | No | unset | utm_content value. |

See the Widget helpdesk for the full integration guide.