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

zeroweight-renderer-react

v0.1.2

Published

React hooks & components for the ZeroWeight avatar renderer. Drop-in LiveKit-powered avatar sessions.

Downloads

313

Readme

zeroweight-renderer-react

React hooks and components for the ZeroWeight avatar renderer. Drop-in LiveKit-powered avatar sessions for React and Next.js.

Installation

npm install zeroweight-renderer-react zeroweight-renderer

Peer Dependencies

The following are required in your project:

npm install react react-dom @livekit/components-react @livekit/components-styles livekit-client lucide-react

LiveKit packages are optional if you only use the renderer without voice chat.

Quick Start

Drop-in Component (Simplest)

import { LiveKitAvatarSession } from "zeroweight-renderer-react";

function App() {
  return (
    <LiveKitAvatarSession
      avatarId="your-avatar-id"
      livekitUrl="wss://your-livekit-server.example.com"
      api={{
        getBundle: (avatarId) =>
          fetch(`/api/avatars/bundle/${avatarId}`).then((r) => r.json()),
        getLiveKitToken: (avatarId, userName) =>
          fetch(
            `/api/livekit/token?avatar_id=${avatarId}&name=${userName}`,
          ).then((r) => r.json()),
      }}
    />
  );
}

This renders a full avatar session with canvas, controls, status badge, and LiveKit voice chat — all wired up automatically.

Custom UI (Full Control)

import {
  useAvatarSession,
  LiveKitAvatarProvider,
} from "zeroweight-renderer-react";
import { LiveKitRoom } from "@livekit/components-react";

function CustomAvatar() {
  const session = useAvatarSession({
    avatarId: "your-avatar-id",
    livekitUrl: "wss://...",
    api: { getBundle, getLiveKitToken },
  });

  return (
    <div>
      {/* Canvas container — renderer injects <canvas> here */}
      <div ref={session.containerRef} style={{ width: 640, height: 480 }} />

      {/* Your own UI */}
      <p>State: {session.rendererState}</p>
      <button onClick={session.connect}>Connect</button>
      <button onClick={session.disconnect}>Disconnect</button>
      <button onClick={() => session.runAction("wave_hand")}>Wave</button>

      {/* LiveKit room for voice (hidden) */}
      {session.token && (
        <LiveKitRoom
          serverUrl={session.livekitUrl}
          token={session.token}
          connect
          audio
          onConnected={session.markConnected}
          onDisconnected={session.disconnect}
        >
          <LiveKitAvatarProvider session={session} />
        </LiveKitRoom>
      )}
    </div>
  );
}

API

ZeroWeightApi Interface

You provide your own backend integration via this interface:

interface ZeroWeightApi {
  getBundle: (avatarId: string) => Promise<{ payload: any }>;
  getLiveKitToken: (
    avatarId: string,
    userName: string,
  ) => Promise<{ token: string }>;
}

useAvatarSession(config)

The core React hook. Manages the renderer lifecycle and returns reactive state + imperative methods.

Config:

| Prop | Type | Required | Description | | ------------------- | --------------- | -------- | ---------------------------------------------- | | avatarId | string | ✅ | Avatar ID to load | | api | ZeroWeightApi | ✅ | Your API implementation | | livekitUrl | string | – | LiveKit server URL | | sessionDuration | number | – | Session limit in seconds (default: 120) | | inactivityTimeout | number | – | Auto-disconnect timeout in ms (default: 30000) |

Returns:

| Property | Type | Description | | --------------- | ----------- | -------------------------------------------------------- | | containerRef | RefObject | Attach to a <div> — renderer creates <canvas> inside | | rendererState | string | "idle" | "loading" | "ready" | "error" | | isEngineReady | boolean | true when renderer is ready | | isConnected | boolean | LiveKit connection status | | connect() | function | Start voice session | | disconnect() | function | End voice session | | runAction(id) | function | Trigger an avatar action | | toggleMic() | function | Toggle microphone mute | | setVolume(v) | function | Set audio volume (0–1) |

Components

| Component | Description | | ----------------------- | -------------------------------------------------- | | LiveKitAvatarSession | Full drop-in: canvas + controls + LiveKit | | AvatarCanvas | Canvas container with loading overlay | | AvatarControls | Default mic/connect buttons | | AvatarStatusBadge | Online/offline status indicator | | LiveKitAvatarProvider | LiveKit ↔ renderer bridge (inside <LiveKitRoom>) |

All components accept a session prop from useAvatarSession().

Integration Example

Adapting an existing API service:

import { api } from "./my-api";
import type { ZeroWeightApi } from "zeroweight-renderer-react";

const zeroWeightApi: ZeroWeightApi = {
  getBundle: (avatarId) => api.getBundle(avatarId),
  getLiveKitToken: (_avatarId, userName) => api.getToken(userName),
};

Build from Source

git clone <repo-url>
cd zeroweight-renderer-react
npm install
npm run build

Output in dist/:

  • zeroweight-renderer-react.es.js — ES module (14 KB)
  • zeroweight-renderer-react.cjs.js — CommonJS (11 KB)
  • *.d.ts — TypeScript declarations

License

MIT