Introducing a new way to review your PRs.

Read the announcement

bas3line / ascii

Animated ascii art for web pages, in TypeScript: React, Next.js, Astro, or one HTML tag

View on GitHub

21 documents · Updated Oct 26, 2026

docs / ascii-art-library

ASCII art library

The ASCII art library is a named collection of reusable animated pictures and text banners. It gives each artwork a stable name and shared rendering contract, then presents the same collection through the website, package entry points, browser elements, framework components, and installable registry items.

Library model

The library treats each artwork as a piece: a self-contained visual with metadata, options, and a way to produce frames. This common shape lets one piece move between output targets without changing the artwork itself.

Artwork pieces

The package keeps the piece names in a generated library index and loads an artwork only when a caller asks for it. The pieces entry point also gives each artwork a named export for direct package use. The index identifies which pieces use colour output, so consumers can select a text or canvas presentation without inspecting each artwork. See the ASCII art catalog for the collection and its categories.

The collection includes reusable UI scenes for a conversation, a branching Git history, and a staged CI run. These pieces use the same metadata and frame contract as the rest of the library, while the conversation and pipeline pieces also allow their displayed content to be supplied by the caller. It also includes the HelixDB logo as a named, colour-capable piece with an optional shine effect.

References: src/library.ts• L3-6 src/library.ts• L109 src/library.ts• L248-257 src/…/index.ts• L4-5 src/…/index.ts• L34-35 src/…/index.ts• L92-94 src/…/index.ts• L107 src/…/index.ts• L161-162 src/…/chat.ts• L8-12 src/…/chat.ts• L48-58 src/…/git-graph.ts• L50-59 src/…/pipeline.ts• L8-16 src/…/pipeline.ts• L57-67 src/…/helixdb.ts• L15-33

Artwork metadata

Each piece supplies the information needed for both rendering and discovery. The website uses that metadata to show a name, category, options, preview frames, and a stable identifier for examples and links.

References: site/…/library.ts• L9-18 site/…/library.ts• L44-60

Product collection

The product-facing collection is built from the same package that consumers use. The site turns the named pieces into browsable groups and ready-to-copy usage examples instead of maintaining a separate set of artwork data.

Catalog groups

The collection is arranged for browsing rather than by source-file order. Scenes come first, followed by interface and brand artwork, with shapes, natural scenes, effects, and other visual types in a broader group. The site includes only pieces with a known catalog category, which keeps the public collection focused.

References: site/…/library.ts• L34-39 site/…/library.ts• L66-78

Usage examples

The collection connects every piece to the main ways a user can use it: a browser tag, React or Next.js, Astro, an SVG in a README, direct module mounting, or the terminal command. These examples make the catalog a product surface and not only an internal index.

References: site/…/library.ts• L128-189

Rendering surfaces

The shared piece contract supports several product surfaces. A text-only piece is presented as preformatted text, while a colour piece can use a canvas; both surfaces expose an image role and an accessible label.

Browser elements

The browser element lets a page select a library piece by name or load a compatible external piece. It starts and stops the piece with the element lifecycle, applies option overrides, and keeps the visual usable as either text or colour output.

References: src/ascii.ts• L7-24 src/ascii.ts• L52-98

Framework components

The React components adapt the same piece model for React and Next.js. Ascii accepts a piece directly, while Banner turns text into a piece before handing it to the shared renderer; this keeps framework use aligned with the library's other surfaces.

References: registry/ascii.tsx• L3-19 registry/ascii.tsx• L21-49 registry/ascii-banner.tsx• L3-14 registry/ascii-banner.tsx• L16-42

Registry distribution

The registry makes the collection copyable into a user's project. It describes the shared library parts, framework components, banners, the creative kit, and each artwork as installable items with the dependencies needed to keep their imports working.

The relationship between a library piece, its public catalog entry, and its installable registry item is shown below.

flowchart LR
    Source[Named artwork piece] --> Index[Library index]
    Index --> Site[Website catalog and examples]
    Index --> Tag[Browser element and package surfaces]
    Index --> Registry[Registry item]
    Registry --> Project[Copied project files]

Registry items

The registry describes each item with a name, title, description, files, and registry dependencies. It also provides an all item that points to the complete collection, so users can install one artwork or the whole library through compatible component tooling. See the component registry for the registry contract and delivery path.

References: site/…/registry.ts• L1-12 site/…/registry.ts• L18-30 site/…/registry.ts• L68-115

Registry index

The public registry index exposes item metadata and file targets as JSON at /r/registry.json. Its base URL can be changed for local or alternate deployments, while item dependencies continue to resolve through that base.

References: site/…/registry.ts• L13-16 site/…/registry.ts• L117-123 site/…/registry.json.ts• L1-7

Change checklist

When these files or sections are changed, remember to consider these:

  • Add or rename a piece in the source collection and regenerate the library and named-export indexes so name lookup, direct imports, site discovery, and registry item generation stay aligned.
  • Keep a piece's category and metadata compatible with the website grouping and preview data, or the piece can disappear from the product catalog.
  • Keep registry dependency names and generated file targets aligned with the copied import layout, or an installed item can fail outside this repository.
  • Keep the registry base URL consistent with the deployment that serves each item, or generated dependency URLs can point to the wrong registry.

Important failure modes

TriggerConsequenceGuard
A generated index does not include a new or renamed pieceName-based tags, direct imports, and registry generation can no longer find the artworkRegenerate both indexes after collection changes
A piece has no recognized catalog category or cannot produce its previewThe website omits it from the public collectionKeep piece metadata and preview behavior valid
A registry item omits a required shared dependencyA copied artwork may have unresolved importsDeclare each item's registry dependencies in the registry description
The registry base points to a host that does not serve the item pathsComponent tooling cannot fetch the requested artworkSet the registry base to the active /r deployment

Key files

FileWhy to read it
src/library.tsDefines the named artwork index and the text-versus-colour distinction.
src/…/index.tsExposes the same collection as named package exports.
src/…/chat.tsShows a configurable conversation scene as a reusable UI piece.
src/…/git-graph.tsShows a Git history scene as a reusable UI piece.
src/…/pipeline.tsShows a staged CI run as a reusable UI piece.
src/…/helixdb.tsShows a branded logo piece with optional animation and colour output.
site/…/library.tsBuilds the product catalog, groups pieces, and creates usage examples.
src/ascii.tsExposes named pieces through the browser-facing element.
site/…/registry.tsMaps shared capabilities and artwork pieces to installable registry items.
site/…/registry.json.tsServes the public registry index used by external tooling.
registry/ascii.tsxShows the React adapter that consumes a library piece.
registry/ascii-banner.tsxShows how generated text banners join the same piece and rendering model.