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

@doki-land/live2d-widget

v0.0.27

Published

Live2D page widget — product chrome over Stage + Actor (no private RAF); built on @doki-land/live2d.

Downloads

1,073

Readme

@doki-land/live2d-widget

An optional webpage character shell built on @doki-land/live2d.

The widget package is intended for blogs, documentation sites, personal sites, and other pages that want a floating or embedded character with messages and controls. It is not a second model runtime and it is not required by game-engine integrations.

✨ Features

  • Mount a character into an existing element.
  • Optional browser-driven animation loop.
  • Pointer tracking and click feedback.
  • Speech bubble with priority and timeout handling.
  • Welcome messages and page-event messages.
  • Hitokoto toolbar action.
  • Canvas screenshot download.
  • Hide/quit action.
  • Renderer fallback configuration passed to the runtime.

🧭 Package Role

Webpage behavior and controls
  -> @doki-land/live2d-widget
  -> @doki-land/live2d
  -> model runtime and renderer

The widget owns webpage presentation such as tips and toolbar actions. Model parsing, parameter evaluation, graphics backends, and resource semantics belong to @doki-land/live2d and its implementation packages.

📦 Installation

pnpm add @doki-land/live2d-widget

🚀 Quick Start


<div id="live2d-widget"></div>
import {mountWidget} from "@doki-land/live2d-widget";

const widget = await mountWidget({
    target: "#live2d-widget",
    model: "/models/character.model3.json",
    width: 280,
    height: 400,
    prefer: ["webgpu", "webgl2", "canvas2d"],
    autoSway: true,
    chrome: true,
});

Destroy the widget when its host is permanently removed:

widget.destroy();

💬 Messages

widget.showMessage("Welcome back.");

widget.showMessage(
    ["Hello.", "Nice to see you again."],
    5000,
    4,
);

Higher-priority messages can temporarily prevent lower-priority page events from replacing important feedback.

🧰 Toolbar

Enable default controls:

const widget = await mountWidget({
    target: host,
    model,
    chrome: true,
});

Or configure them explicitly:

const widget = await mountWidget({
    target: host,
    model,
    chrome: {
        tips: true,
        welcome: ["Welcome to the site."],
        tools: ["hitokoto", "photo", "quit"],
        hitokotoApi: "https://v1.hitokoto.cn",
    },
});

The Hitokoto action performs a network request. Sites with strict privacy or content-security requirements should disable it or provide an approved endpoint.

🖱️ Interaction

await mountWidget({
    target: host,
    model,
    onHit({area, x, y}) {
        console.log(area, x, y);
    },
});

Pointer tracking drives supported focus parameters. Exact visible behavior depends on the parameter definitions and deformation data in the loaded model.

📝 Blog Engines

The package is suitable as the shared browser layer for blog-engine adapters. An adapter should only:

  • read host configuration;
  • emit or copy browser assets;
  • create the target element;
  • pass options to the widget;
  • integrate with the host's navigation lifecycle.

It should not copy model decoding, rendering, pointer math, or message behavior into the adapter.

🎮 Game Engines

Game engines should normally use @doki-land/live2d directly. The widget creates webpage chrome and may own a browser animation loop, which is usually inappropriate when an engine already controls its canvas, scheduler, input system, and scene lifecycle.

🔒 Privacy and Security

  • Remote models and Hitokoto endpoints are network dependencies.
  • Screenshot export may fail when textures make the canvas origin-unclean.
  • Apply a content-security policy appropriate for model, texture, and API origins.
  • Do not forward authentication credentials to arbitrary user-provided URLs.
  • Provide a network-free configuration for privacy-sensitive sites.

🧪 Development

pnpm --filter @doki-land/live2d-widget typecheck
pnpm --filter @doki-land/live2d-widget test

Widget changes should test listener cleanup, repeated mount/destroy behavior, message priority, toolbar actions, and hosts without optional browser capabilities.

🤝 Contributing

Keep this package focused on webpage character behavior. Runtime and renderer changes belong in their owning packages.

📄 License

Source code is dedicated to the public domain under CC0 1.0 Universal — see License.md. Character models and message-service content may have separate terms.