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

@vctrl/embed

v0.22.0

Published

Framework-agnostic JavaScript SDK for controlling Vectreal embedded 3D scene previews via postMessage.

Readme

@vctrl/embed

npm License: AGPL-3.0

Framework-agnostic JavaScript SDK for controlling Vectreal embedded 3D scene previews from any web page.

Installation

npm install @vctrl/embed

CDN (UMD — no bundler needed):

<script src="https://cdn.vectreal.com/embed/latest/vectreal-embed.umd.js"></script>

Quick start

<div style="width: 100%; height: 400px;">
	<iframe
		id="vectreal-scene"
		src="https://vectreal.com/preview/fullscreen/<projectId>/<sceneId>?token=YOUR_PREVIEW_API_KEY"
		style="width: 100%; height: 100%; border: 0;"
		allow="autoplay; xr-spatial-tracking"
		allowfullscreen
	></iframe>
</div>

<script type="module">
	import { VectrealEmbed } from '@vctrl/embed'

	const embed = new VectrealEmbed(document.getElementById('vectreal-scene'))

	const { cameras } = await embed.ready()
	console.log('Available cameras:', cameras)

	embed.on('camera_changed', ({ cameraId }) => {
		console.log('Camera changed to:', cameraId)
	})

	embed.activateCamera('detail')
</script>

API

new VectrealEmbed(iframe, options?)

| Option | Type | Default | Description | | -------------- | -------- | ------------------------------- | ------------------------------------------------ | | iframeOrigin | string | Auto-detected from iframe.src | Expected iframe origin for postMessage security. | | readyTimeout | number | 15000 | ms before ready() rejects. |

Methods

| Method | Description | | -------------------------------- | -------------------------------------------------------------- | | ready() | Resolves with { sceneId, cameras } when the viewer is ready. | | activateCamera(cameraId) | Switch to a named camera. | | setTransition(options) | Override transition type, duration, and easing. | | setControlsEnabled(enabled) | Enable or disable orbit controls. | | setAutoRotate(enabled, speed?) | Toggle auto-rotate. | | setZoomEnabled(enabled) | Toggle scroll-zoom. | | setPanEnabled(enabled) | Toggle right-click pan. | | sendScrollProgress(progress) | Drive scroll-triggered interactions (0–1). | | sendMessage(message, payload?) | Trigger a named host_message interaction. | | on(type, handler) | Subscribe to a viewer event. Returns unsubscribe. | | off(type, handler) | Remove a specific handler. | | destroy() | Remove all listeners and stop processing messages. |

Events

| Type | Payload | When | | --------------------- | ----------------------------------------- | ------------------------------------------------------- | | viewer_ready | void | Viewer command surface is registered. | | model_loaded | void | Model finished loading and initial framing is complete. | | camera_changed | { cameraId } | Active camera changed. | | auto_rotate_changed | { enabled } | Auto-rotate state changed. | | interaction_event | { eventName, interactionId?, payload? } | Publisher custom event fired. |

URL parameter shorthand

For static initial configuration without JavaScript, add query parameters to the iframe src:

| Parameter | Example | Effect | | -------------------- | -------------------- | ------------------------------------- | | ?camera=<id> | ?camera=hero | Activates a camera on viewer_ready. | | ?autoRotate=0 | ?autoRotate=1 | Overrides stored auto-rotate state. | | ?transition=<type> | ?transition=linear | Overrides stored transition type. |

Documentation

Full guide and examples: vectreal.com/docs/guides/embed-sdk

License

AGPL-3.0-only — see LICENSE.

Part of the Vectreal Platform monorepo.