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

@teletext/react

v0.1.1

Published

Embeddable ASCII art components for React

Readme

@teletext/react

Embed ASCII art animations in any React app. One component, zero config.

Install

npm install @teletext/react

Usage

Export a .teletext file from teletext.com, drop it in your public/ directory, and point at it:

import { TeletextEmbed } from '@teletext/react'

<TeletextEmbed data="/animation.teletext" autoPlay loop />

Or pass raw bytes:

const bytes = new Uint8Array(await fetch('/animation.teletext').then(r => r.arrayBuffer()))
<TeletextEmbed data={bytes} autoPlay loop />

Examples

Full-screen background

<TeletextEmbed
  data="/bg.teletext"
  autoPlay
  loop
  backgroundColor="#000"
  style={{ position: 'fixed', inset: 0, opacity: 0.3, zIndex: -1 }}
/>

Hero section

<TeletextEmbed
  data="/animation.teletext"
  autoPlay
  loop
  fontFamily="'Fira Code', monospace"
  className="w-full h-[400px]"
/>

SSR-safe rendering

The dom renderer outputs <pre> and <span> elements — no canvas, works with SSR, accessible to screen readers.

<TeletextEmbed data="/animation.teletext" renderer="dom" autoPlay loop />

Pause / resume

const [paused, setPaused] = useState(false)

<TeletextEmbed data="/animation.teletext" autoPlay loop paused={paused} />
<button onClick={() => setPaused(p => !p)}>
  {paused ? 'Play' : 'Pause'}
</button>

Single frame (low-level)

import { TeletextCanvas, TeletextDom, loadTeletext } from '@teletext/react'

const data = await loadTeletext('/animation.teletext')
<TeletextCanvas frame={data.frames[0]} cellSize={12} />
<TeletextDom frame={data.frames[0]} />

API

<TeletextEmbed>

| Prop | Type | Default | | |------|------|---------|---| | data | Uint8Array \| string | required | Binary bytes or URL to .teletext file | | renderer | "canvas" \| "dom" | "canvas" | Canvas = fast. DOM = SSR + accessible. | | autoPlay | boolean | false | Play on mount | | loop | boolean | false | Loop the animation | | paused | boolean | false | External pause control | | fps | number | from export | Override frame rate | | fontFamily | string | "monospace" | Any monospace font | | backgroundColor | string | "#111" | Background color | | className | string | — | Wrapper CSS class | | style | CSSProperties | — | Wrapper inline styles | | aria-label | string | "ASCII art animation" | Accessibility label |

The canvas scales to fill its container. Animations automatically pause when off-screen via IntersectionObserver.

<TeletextCanvas>

Renders a single frame to <canvas>. Scales to fill its container.

| Prop | Type | Default | | |------|------|---------|---| | frame | TeletextFrame | required | Single frame to render | | cellSize | number | 10 | Character size in px | | fontFamily | string | "monospace" | Font | | backgroundColor | string | "#111" | Background |

Ref: getCanvas() returns the <canvas> element.

<TeletextDom>

Renders a single frame as <pre> + colored <span> elements.

| Prop | Type | Default | | |------|------|---------|---| | frame | TeletextFrame | required | Single frame to render | | fontFamily | string | "monospace" | Font | | backgroundColor | string | "#111" | Background |

Codec

Encode and decode .teletext binary files directly:

import { encode, decode, loadTeletext } from '@teletext/react'

// Decode from URL
const data = await loadTeletext('/animation.teletext')

// Decode from bytes
const data = await decode(bytes)

// Encode TeletextData to compressed binary
const bytes = await encode(data)

Utilities

For custom renderers or playback logic:

import { renderCanvasFrame, renderDomFrame, getFrameIndex } from '@teletext/react'

// Draw to any canvas context
renderCanvasFrame(ctx, frame, { cellSize: 10 })

// Get React elements
const elements = renderDomFrame(frame)

// Frame timing math
const index = getFrameIndex(elapsedMs, frameCount, fps, loop)

.teletext binary format

Compressed binary — each cell is 1 byte (space) or 4 bytes (char index + RGB), gzipped with browser-native CompressionStream. Typical compression results:

| Content | JSON | .teletext | Reduction | |---------|------|-------------|-----------| | 51x91, 85 frames | 13 MB | 201 KB | 98.5% | | 90x160, 85 frames | 43 MB | 1.6 MB | 96.3% |

Requirements

React 18+. No other dependencies.

License

MIT