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

ui-visual-engine

v0.1.2

Published

JSON-driven, narration-synchronized animated lesson player for React (cinematic and scrolling modes).

Readme

ui-visual-engine

A JSON-driven animated lesson player for React. You send a lesson as JSON plus narration audio (files, links or in-memory blobs, whole or in chunks). It plays as a video-like lesson (cinematic) or a growing scrolling page (vertical), with the visuals synced to the voice.

Install

# from the public npm registry
npm i ui-visual-engine
# or from a packed file / folder
npm i ./ui-visual-engine-0.1.2.tgz

Peer dependencies: react and react-dom >=18.2 and <20.

Use

import { useMemo } from 'react';
import { VisualPlayer } from 'ui-visual-engine';
import 'ui-visual-engine/style.css';

export function Lesson() {
  const source = useMemo(() => ({ url: '/lessons/my-lesson/lesson.json' }), []);
  return (
    <div style={{ height: '100vh' }}>
      <VisualPlayer source={source} />
    </div>
  );
}
  • The player fills its parent, so give the parent a height.
  • Memoize source: a new object reloads the lesson.

Responsive by design (0.1.1)

The player sizes itself from its parent element, never the window. Give the parent a size; everything inside follows it, live, even while a lesson is playing.

<div style={{ width: '100%', height: '70dvh' }}>            {/* any size: page, card, sidebar, modal */}
  <VisualPlayer source={source} options={{ presentation: { mode: 'auto' } }} />
</div>
  • mode: 'auto' picks cinematic for roomy landscape boxes and the scrolling page for small, narrow or short boxes, and switches live when the box changes (with hysteresis, and playback keeps going). A learner's own choice with the mode button wins.
  • Text, controls, overlays and icons scale with the player (--vle-u, container units); no fixed pixel sizes or viewport units are used inside the player.
  • Diagrams measure their own box and pick the first readable arrangement: the authored layout, its portrait layout, then automatic snaking grids. Sideways panning is a last resort.
  • List-item highlights light the item's text (no full-width boxes); release: true turns each off after its sentence.
  • Floating buttons never cover content: "Enlarge" sits under drawings on reading pages, and the "Follow narration" pill gives way to the control-bar button when there is no side gutter.

Sources

{ url: 'https://cdn.example.com/lessons/x/lesson.json' }   // link
{ lesson: jsonObject }                                       // direct JSON
{ json: jsonText }                                           // JSON string
{ file: fileOrBlob }                                         // local file
{ lesson, assets: { 'audio/s1-1.mp3': ttsBlob } }            // in-memory voice/images
{ lesson, streaming: true }                                  // more scenes follow (engine.appendScenes)

Options you'll usually set:

<VisualPlayer
  source={source}
  options={{ allowedOrigins: ['https://cdn.example.com'], presentation: { mode: 'vertical' }, dev: true }}
  onEngine={(engine) => { /* engine.appendScenes(...), engine.finishStream(), engine.play() … */ }}
/>

Voice in chunks (no timing maths)

"narration": { "chunks": [
  { "id": "c1", "src": "audio/s1-1.mp3", "text": "First sentence." },
  { "id": "c2", "src": "audio/s1-2.mp3", "text": "Second sentence." }
] }

The player measures each file, plays the chunks in order, and syncs animations ("at": { "cue": "c2" }) and captions to them.

Documentation (included in this package)

  • docs/SETUP_GUIDE.md: setup, the full API, the content pipeline (LLM → JSON → TTS → player), streaming, deployment, troubleshooting.
  • docs/LESSON_AUTHORING_GUIDE.md: the lesson JSON format, effects, layouts, quality rules, and the LLM generation prompt.
  • docs/VISUAL_ENGINE.md: architecture and extension points (custom renderers, effects, themes, layouts, presentation modes).

Notes

  • ESM-only package. The packed artifact is checked with React 18.3.1, TypeScript and Vite. Next.js, webpack and React 19 compatibility have not yet been verified.
  • Use it in a browser component only. With Next.js, add 'use client'.
  • GSAP is distributed under GSAP's own no-charge license.

Build and verify (from the repository root)

npm run test:package       # build, pack, check strict consumer types and Vite build
npm run pack:package       # build automatically and create the .tgz

Packing and publishing from this repository automatically builds the package first. The package is configured for public npm access. Build, check and pack commands do not publish it. To release version 0.1.2, run npm publish from this package directory after verification.