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

@ghchinoy/lit-text-ui

v0.2.6

Published

A high-performance Canvas-based text editor for AI prompt experiences, powered by Pretext

Readme

Lit Text UI

A high-performance Canvas-based text editor component library for AI prompt experiences and synchronized audio-transcript playback, powered by Pretext and Lit.

This library complements the lit-audio-ui package, focusing on text layout, kinetic lyrics rendering, and interactive editing, while avoiding the layout reflow bottlenecks common with traditional DOM-based text handling.

Take a look at the interactive gallery and documentation to see the components in action.

Why Canvas Text?

When building experiences like real-time text generation (AI streaming) or sub-second word highlighting (synchronized TTS playback), typical HTML text rapidly triggers browser "layout thrashing".

By leveraging @chenglou/pretext, this library measures and renders multiline text directly to a <canvas>, making it ideal for 60fps animations, highlight syncing, and large volumes of streaming text.

How to Use

1. Installation

npm install @ghchinoy/lit-text-ui

2. Import the Library

// Import the entire library
import '@ghchinoy/lit-text-ui';

// Or import specific components
import '@ghchinoy/lit-text-ui/organisms/ui-audio-tag-editor.js';
import '@ghchinoy/lit-text-ui/atoms/ui-synced-transcript.js';

3. Required Fonts & Icons

This library inherits fonts from your host application. To ensure identical rendering in the canvas as standard DOM text, please explicitly define your fonts or inherit Material 3 design tokens:

:root {
  --md-sys-typescale-body-large-font-family-name: "Inter", system-ui, sans-serif;
}

Available Components

🧪 Atoms (Primitives)

  • <ui-synced-transcript>: A canvas-based text block that accepts word-level timestamps to provide smooth, sub-millisecond highlighting synchronized with audio playback.

🧬 Organisms (Composites)

  • <ui-audio-tag-editor>: A specialized text area with an interactive, autocomplete-driven dropdown for inserting and displaying "audio style tags" (e.g., [laughing], [short pause]) as formatted pills over raw text.
  • <ui-chat-log>: A high-performance canvas log for large, streaming text generations.

Customizing The ui-audio-tag-editor

The ui-audio-tag-editor component supports custom audio markup tags and adjustable rendering to match your API's required prompt formats.

<ui-audio-tag-editor 
  .tags=${myCustomTags} 
  pillPadding="8"
  pillOffsetY="-2"
  @change=${(e) => console.log('Raw prompt sent to API:', e.detail.value)}
></ui-audio-tag-editor>

Your tags property must implement the AudioTag interface:

interface AudioTag {
  id: string;       // e.g., 'sigh' (translates to '[sigh]' in text)
  label: string;    // Displayed in the dropdown e.g. '[sigh]'
  category: string; // Used for coloring (e.g. 'Non-Speech', 'Style')
  description: string;
}

🎨 Theming

Customize colors via standard CSS variables (Material Design 3 compatible):

:root {
  /* Colors */
  --md-sys-color-primary: #0066cc;
  --md-sys-color-surface-container-highest: #f5f5f5;
}

📚 Samples & Demos

Check out the following resources in the repository:

License

Apache 2.0; see LICENSE for details.