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

@vitra/image-creator-embed

v0.1.3

Published

Browser iframe mounter for the Vitra Image Creation Platform. Framework-agnostic; ~2 KB.

Readme

@vitra/image-creator-embed

Framework-agnostic browser iframe mounter for the Vitra Image Creation Platform. ~6 KB gzipped, zero dependencies.

For React, use @vitra/image-creator-react instead — it wraps this package with a typed component.

Install

npm install @vitra/image-creator-embed

Usage

import { VitraEmbed } from "@vitra/image-creator-embed";

const embed = VitraEmbed.mount(document.getElementById("creator")!, {
  sessionEndpoint: "/api/vitra/session",
  theme: { "--brand-500": "#D4512C", "--bg": "#14110F" },
  onReady: () => console.log("mounted"),
  onAssetReady: (e) => downloadAndSave(e.signed_url),
  onError: (e) => console.error(e.reason, e.detail),
});

// Later:
embed.setTheme({ "--brand-500": "#2A6E4E" });
embed.unmount();

How it works

  1. You wire up a sessionEndpoint on your host backend that returns a bootstrap token (use @vitra/image-creator-node).
  2. On mount(), the SDK fetches a bootstrap token from that endpoint.
  3. It sets iframe.src = https://image-creator.vitra.ai/embed#bt=<token>. The token lives in the URL fragment (not query) so it never hits server logs or Referer headers.
  4. Inside the iframe, the Image Creator exchanges the one-time bootstrap for a short-lived session JWT (5 min). The parent NEVER sees that JWT.
  5. If the session expires and the Partitioned cookie fallback didn't survive, the iframe posts {type: "session.expired"} — the SDK silently fetches a fresh bootstrap and re-mounts. Invisible to the user.

Security model

The SDK enforces three checks on every inbound postMessage:

  • event.origin matches the baseUrl origin
  • event.source matches the iframe's contentWindow
  • the message shape contains a known type field

These checks are internal and cannot be overridden. Messages that fail are silently dropped (with a console.warn at dev time). This is the Codex F2 mitigation against iframe spoofing.

Events

| Event | When | |-------|------| | onReady() | Iframe finished bootstrap exchange | | onAssetReady(e) | A generated asset is available — signed URL + metadata | | onAssetFailed(e) | Generation failed after reserve | | onCreditUsed(e) | Credits captured — use for live "spent" UI | | onResize(e) | Iframe requested a height change | | onError(e) | Unrecoverable error |

The session.expired event is handled by the SDK automatically — no public callback; observe via the iframe's behavior rather than wiring it manually.

License

Apache-2.0.