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

glyphix-tui

v1.0.1

Published

**High-Performance, Low-Level Terminal User Interface Renderer for Node.js**

Readme

glyphix-tui

High-Performance, Low-Level Terminal User Interface Renderer for Node.js

glyphix-tui is a minimal, unopinionated, and highly optimized TUI rendering engine. It is designed to be the foundational "pixel pusher" for higher-level frameworks or performance-critical terminal applications.

日本語ドキュメント (Japanese)


Philosophy

  • Single Source of Truth: The Buffer is the only truth. What you put in the buffer is what gets rendered.
  • Zero Abstraction Cost: No hidden object allocations per cell. Everything is a 32-bit integer.
  • Correctness First: The Renderer is a state machine that guarantees the terminal screen matches the buffer exactly, resolving complex attribute overlaps.
  • Performance: Optimized diffing algorithms ensure only the necessary ANSI sequences are sent to the terminal.

Capabilities (What It Does)

  • Bit-Packed Glyphs: Store character (ASCII), foreground color (xterm-256), background color (xterm-256), and attributes (Bold, Underline, etc.) in a single 32-bit integer.
  • Efficient Rendering: Compares current and previous frames to emit minimal ANSI escape codes.
  • State Management: Automatically handles ANSI state synchronization (colors, attributes), resetting only when necessary.
  • Typed Arrays: Uses Uint32Array for buffer storage, ensuring cache locality and low memory overhead.

Non-Goals (What It Doesn't Do)

glyphix-tui is NOT a widget library. To keep the core lightweight and fast, the following are explicitly out of scope:

  • Widgets: No buttons, lists, or text boxes.
  • Layouts: No Flexbox or Grid systems.
  • Input Handling: No keyboard or mouse event listeners.
  • Unicode/Wide Characters: Strictly ASCII-oriented for predictable cell width (1 byte = 1 cell).

Installation

npm install glyphix-tui

Usage

Basic Example

const { Buffer, Renderer, Glyph, Attr } = require("glyphix-tui");

const WIDTH = 40;
const HEIGHT = 10;

// 1. Initialize Buffer and Renderer
const buf = new Buffer(WIDTH, HEIGHT);
const renderer = new Renderer(process.stdout, WIDTH, HEIGHT);

// 2. helper for packing glyphs
const { pack } = Glyph;

// 3. Draw to the buffer
// Example: Draw a red 'A' with bold attribute at (0, 0)
const char = "A".charCodeAt(0);
const fg = 196; // Red (xterm-256)
const bg = 0; // Black
const attr = Attr.BOLD | Attr.UNDERLINE;

buf.cells[0] = pack(char, fg, bg, attr);

// 4. Commit to the terminal
renderer.commit(buf);

Using Helpers

For convenience, light helper functions are provided for common drawing operations. Helpers are pure convenience utilities and do not affect the core rendering model or performance characteristics.

const { helper, Glyph } = require("glyphix-tui");

// Fill background with blue
helper.fillRect(buf, 0, 0, WIDTH, HEIGHT, Glyph.pack(32, 255, 21, 0));

// Draw text
helper.drawText(buf, 2, 2, "Hello World", (code) =>
  Glyph.pack(code, 255, 21, Glyph.Attr.BOLD),
);

renderer.commit(buf);

Documentation

Detailed documentation is available in the docs/ directory:

  • Buffer: Memory structure and manipulation.
  • Glyph: Bit-packing details and color/attribute handling.
  • Renderer: Rendering lifecycle and diffing algorithm.
  • Attributes: List of available style flags.
  • Specification: The core specification document.

License

MIT