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

@smallstack/web-component-sdk

v1.0.0

Published

Bridge client SDK for smallstack Business Platform third-party web components

Downloads

89

Readme

@smallstack/web-component-sdk

Typed bridge client for third-party web components running inside the smallstack Business Platform sandbox. Use it instead of raw postMessage.

The major version tracks the bridge protocol version (SDK 1.x ⇄ protocol 1).

Usage

import { connect } from "@smallstack/web-component-sdk";

class MyWidgetElement extends HTMLElement {
	#client;
	#cleanup = [];

	async connectedCallback() {
		const shadow = this.attachShadow({ mode: "open" });
		this.#client = connect(this);
		// platform theme (daisyUI tokens, light/dark) — kept in sync live
		this.#cleanup.push(this.#client.adoptThemeStylesheets(shadow));
		// auto-report height so the host iframe sizes itself
		this.#cleanup.push(this.#client.observeResize());

		const { grantedScopes } = await this.#client.whenInitialized();
		const profile = this.#client.getUserProfile(); // user-profile:read
		this.#client.onData(() => {
			// collection data, keyed by the widget-config property bound at
			// placement time (see the collection:{configurationProperty}:{action}
			// scope scheme)
			const orders = this.#client.getCollection("orders");
			// ...render
		});
	}

	disconnectedCallback() {
		for (const cleanup of this.#cleanup) cleanup();
		this.#client?.disconnect();
	}
}

Testing your component

WebComponentMockHost emulates the platform host page (handshake, data pushes, theme switches) for unit tests and the local dev harness:

import { WebComponentMockHost } from "@smallstack/web-component-sdk";

const host = new WebComponentMockHost(element);
host.init({ grantedScopes: ["user-profile:read"], data: { userProfile } });
host.pushData({ orders: [{ id: "o1" }] });
host.pushTheme({ name: "dark", dark: true });
const resize = await host.waitForMessage("resize");

Protocol package

The wire protocol lives in its own zero-dependency package, @smallstack/web-component-bridge-protocol, which this SDK depends on and re-exports. That package is the single source of truth: the platform (@smallstack/shared in smallstack/business-platform) will re-export the same module once it adopts the package — a follow-up to the initial publish — replacing today's hand-synced copy so there is no mirror to keep in sync.

The SDK's major version tracks the protocol package's major (SDK 1.x ⇄ protocol 1). A breaking envelope change is a major bump of the protocol package and of this SDK; a stale bundle carries the old version and is rejected at the boundary. See the protocol package README for the full release rule.