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

@lute-lang/player-web

v0.53.1

Published

The Lute web visual-novel player: PixiJS 8 renderer, Web Audio, screens and input over @lute-lang/player.

Readme

@lute-lang/player-web

The Lute 0.53 browser visual-novel player. It supplies PixiJS 8 rendering, Web Audio, screens, and keyboard/mouse/touch/gamepad input for the renderer-free @lute-lang/player core.

Install

  bun add @lute-lang/[email protected] @lute-lang/[email protected] @lute-lang/[email protected] [email protected] @effect/[email protected] [email protected] @pixi/[email protected]
  # npm install @lute-lang/[email protected] @lute-lang/[email protected] @lute-lang/[email protected] [email protected] @effect/[email protected] [email protected] @pixi/[email protected]

The package requires exact [email protected] and @effect/[email protected] peers. Runtime and player packages are released in lockstep.

Minimal usage

Serve a lute compile --project bundle, the runtime wasm file, the bindings file, and its assets. Then mount into an element:

import { mountPlayer } from "@lute-lang/player-web"

const options = {
  bindings: { url: "/player.bindings.yaml" },
  bundleUrl: "/bundle/",
  wasmUrl: "/wasm/lute_runtime_wasm_bg.wasm",
  assetsUrl: "/assets/",
  storageKey: "my-game"
} as const
const player = await mountPlayer(document.querySelector("#player")!, options)

await player.act({ type: "newGame" })
const view = await player.view()
// A player save can resume a fresh player:
const save = await player.snapshot()
await player.unmount()
const resumed = await mountPlayer(document.querySelector("#player")!, { ...options, snapshot: save.snapshot })
await resumed.restore(save)
// Later:
await resumed.unmount()

mountPlayer returns Promise methods act, view, send, snapshot, restore, and unmount, plus the handle's session, program, and bundle values (session.current holds the state program's read-only queries take). The methods run the same Effects as the scoped LuteWeb.mount handle and reject with the Effect failure. The handle's bundle is the exact compiled bundle loaded by the player, so hosts can inspect artifacts without loading it again. MountOptions accepts the same seed/snapshot/session start union and cueFactory, linePacing, and autosave options as LutePlayer.make. Textures use a private Pixi asset manager; player-web does not initialize Pixi's global Assets.

When bindings define ui.ended, an ended state member selects a named ending screen. Player-web queries program.view(state) (the runtime's WorldView) at ended and selects a screen only when the entry at ui.ended.by is a { kind: "str", value } whose value screens maps; it displays that screen's title and text and loads its optional background through the private asset manager. An absent entry, another kind, an unmapped member or a failing query keeps the stock ending screen.

The stage is drawn in fixed layers, bottom to top: background, camera (actors), cg, video, dialogue, choice, overlay, transition. A ::cg covers the actors and stays under the dialogue window and UI.

The title screen's heading is the bound ui.title.text; without it the title draws no heading (never a placeholder name). Without ui.title.background the title has no backdrop, and without ui.title.music it plays no music.

Cue handling

  • Names. The dialogue name plate and backlog rows show speakerName, the cast display name from the bundle index (cast: { id: name }); name colours stay keyed by the speaker id.
  • Music. PixiAudio honours AudioPlay.restart: restart: true plays the file from its start; without it, the music file already playing only changes volume, fading over fade, and a different file crossfades. Audio plays only after a user gesture unlocks it; until then a music play waits, and a later music play or stop supersedes every earlier music play still waiting (for the unlock, its file or the backend), which completes without starting (at once while it waits for the unlock; a backend play that resolves after it was superseded is stopped, never recorded). So a load before any gesture reaches its restored await at once, and the loaded stage's music (not the title music requested at mount) starts when audio unlocks.
  • Camera. The camera layer rests at alpha 1 with no mask. A transition with a hiding effect (fade, dissolve, fadeOut, wipe*, slideLeft/slideRight, slideOut) hides the actors over the first half, applies the framing, and shows them over the second half; other effects apply the framing, then play. Every cue ends visible in its framing; cut, none, a zero duration and skip apply it at once; a started transition keeps playing after its batch ends (it runs in the player's scope); a later camera cue supersedes it, and so does skip when it starts while the cue still runs (a transition whose cue already ended finishes at normal speed); a move takes precedence; a wipe sweeps the design stage, not the actors' span; restore (load, rollback) cancels running camera behaviours and rests the layer before applying the framing.
  • Custom vfx. A StageCue.Vfx whose effect.effect is "custom" (a project vfx bound as { effect: custom }, or a vfx type with no binding) has no Pixi effect: the presenter plays nothing and logs effect.name once at debug level (PresenterOptions.debug, default console.debug). Render project effects with your own Presenter.

Tests

bun run test           # unit tests (node); real-runtime tests compile fixtures with the lute binary
bun run test:browser   # Chromium (vitest browser mode, WebGL via SwiftShader); projects `browser` and `real` (test/browser/real, one file at a time)
bun run test:e2e       # Playwright over `bun run demo`

The suites build the CLI with cargo build -q -p lute-cli unless LUTE_BIN names a lute executable.

Player behaviour is tested against real runtime output, never a hand-written view, record or bundle:

  • Node. test/support/bundle.ts compiles a project (compileProject(name, dir, locales?), locales a lute loc import bundle passed as --locale-bundle; output under node_modules/.lute-test/); tests drive it with @lute-lang/runtime/bun (see test/ui/ended.test.ts).
  • Browser. The real project (test/browser/real/, in vitest.browser.config.ts) runs its files one at a time: its players animate on the per-frame clock (at most 0.1s a frame), so files rendering side by side on a few CPUs stretch every playthrough past its deadlines; the batch-end camera test reads the player's clock (pixi.frames), not wall time. Its test/browser/globalSetup.ts compiles once the projects registered in realProjects (globalSetup.ts: examples/player-demo with its Korean bundle locales/bundle.json, and fixtures under test/fixtures/; add new fixtures there) and provides its URLs (inject("luteProjects"); vite serves them through /@fs/). test/browser/support/real-player.ts mounts player-web with mount over that bundle and the packaged wasm runtime: mountProject(name, options?) (demo = examples/player-demo, others under test/fixtures/) (a fresh storageKey unless one is passed; mounting again with the same key after close() models a reload over the same storage), playUntil(player, stop, prefer?) plays with real PlayerActions (New game, idle menu, choices by preferred option id, advance), playReading(player, stop, prefer?) plays the same way but records every dialogue line and choice menu as drawn and advances a line only after reading it (each fails when stop does not hold within playthroughMs, 300 s: the demo played to an ending takes about 1 min on a fast machine, over 2 min on a CI runner; a test making count such calls takes playthroughTimeout(count)), buttonLabelled(container, label) finds a drawn button to activate(), and assertions read what player-web drew: player.pixi.layers (the mounted Pixi stage from the internal pixiAppOf(element), not exported from the package), drawnTexts(container) and stagePixels(pixi, frame). See test/browser/real/.

API and guides

Source and releases: github.com/journeyWorker/lute.