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 / component-registry

Component registry

The component registry packages ascii.rest capabilities as named, installable units for external component tools. It lets a developer discover a piece or library feature through a JSON index, then copy the needed source into a project instead of taking the whole npm package.

Registry purpose

The registry is the bridge between the ASCII art library and tools that install source components. The registry entries are served as JSON under /r/, while the ASCII art library remains the source of the pieces and shared capabilities.

The main consumers are:

  • shadcn: reads the registry schema and installs entries by URL or registered name.
  • npx ascii.rest add: reads the same entries and installs them without shadcn.
  • People and agents: use the registry index to discover available names and their relationships.

References: site/…/registry.ts• L1-16 site/…/registry.json.ts• L1-7 site/…/[name].json.ts• L1-12 site/…/copy.md• L14-16

Registry entry model

Each registry entry describes one capability and the source files that provide it. It also names other entries that must be installed first, so a request for one feature can produce a complete local set of files.

Capability groups

The registry groups the library into a small set of product-facing capabilities. A piece entry supplies one artwork. Core, banner, SVG, and kit entries supply shared library features. The React entries expose <Ascii> and <Banner> as copyable components.

Entry groupCapabilityTypical result
corePiece contract and mountingShared support for local pieces
bannerText converted to block-letter artA reusable text-art capability
svgPiece or banner converted to animated SVGArt for SVG-capable surfaces
kitTools for making new ASCII artA local creative coding kit
asciiReact and Next.js piece displayA local <Ascii> component
ascii-bannerReact and Next.js text displayA local <Banner> component
Piece namesOne catalog artworkA local file for that piece
allThe complete registry setEvery supported capability and piece

References: site/…/registry.ts• L18-30 site/…/registry.ts• L68-115 site/…/copy.md• L190-205

Dependency graph

Registry dependencies describe capability relationships rather than npm package installation. For example, a React piece display needs the core piece contract, while a banner component needs the display component and the banner capability. The installer follows these links and installs dependencies before the requested entry.

flowchart TD
  Request[Requested registry item] --> Entry[Item JSON]
  Entry --> Dependencies[Registry dependencies]
  Dependencies --> Core[core]
  Dependencies --> Capability[Shared capability]
  Entry --> Files[Source files]
  Core --> Local[Complete local component set]
  Capability --> Local
  Files --> Local

The all entry is a discovery and bulk-install path. It points to every other entry instead of carrying source files of its own.

References: site/…/registry.ts• L54-63 site/…/registry.ts• L68-115 src/cli.ts• L83-117 site/…/copy.md• L118-126

Discovery and installation flow

The registry exposes one index and one item document per name. External tooling starts with the index or a known item URL, follows registry dependencies, and then places the returned source in the project's component area.

When a developer requests an item, the flow is:

  1. The tool resolves a name such as donut to /r/donut.json.
  2. The item document identifies its files and registry dependencies.
  3. Dependencies are fetched once and handled before the requested item.
  4. The tool validates file targets and external package names.
  5. The source is copied into the local ASCII component area.

The copied files are intentionally local. They can be changed by the project and do not change when the registry changes. This makes the registry an installation source, not a runtime service.

References: site/…/[name].json.ts• L7-12 src/cli.ts• L83-164 site/…/copy.md• L118-135 site/…/copy.md• L209-238

Registry boundaries

The registry covers source that can stand on its own inside a project. It does not replace the full npm package, so package features that depend on the package's runtime entry points remain outside this copy-based path.

The registry supports:

  • individual pieces from the ASCII art catalog;
  • shared source for mounting, banners, SVG output, and the creative kit;
  • React and Next.js display components;
  • an aggregate entry for bulk installation.

The npm package remains the right boundary for the web component, Astro adapters, and terminal APIs. Those surfaces rely on package-level exports rather than registry entries.

References: site/…/registry.ts• L32-39 site/…/registry.ts• L82-103 site/…/copy.md• L41-55 package.json• L18-60

Change checklist

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

  • A new or renamed piece must remain visible through the catalog data used by the registry's piece mapping, or it will not receive an entry.
  • A shared capability change must keep its registry dependency links aligned with the imports that copied files use.
  • A React registry component change must keep its React package dependency and its links to shared capabilities accurate.
  • A registry schema or endpoint change must remain compatible with both the shadcn item format and the CLI item reader.
  • A change to the registry base URL must keep generated dependency URLs and CLI registry overrides consistent.

Important failure modes

TriggerConsequenceGuard
An item name does not existThe installer stops before copying that requestUse the registry index or the catalog's exact slug
A dependency link is missing or wrongThe copied feature lacks source that its imports needUpdate the entry's registry dependency set with its capability links
An external item contains an unsafe path or non-text contentThe CLI refuses the whole add operation before writingValidate every item and file target before installation
A React entry omits its React dependencyThe copied component can fail to install or buildKeep the entry's package dependency declaration aligned with its imports
A copied file is overwritten after local editsLocal changes can be lostReview the diff before using overwrite behavior

Key files

FileWhy to read it
site/…/registry.tsDefines the item model, capability entries, dependency graph, and registry index
site/…/registry.json.tsExposes the discovery index consumed by registry tooling
site/…/[name].json.tsExposes each installable item and its source files
src/cli.tsShows how the standalone installer resolves dependencies, validates input, and writes files
registry/ascii.tsxShows the React piece-display capability packaged for copying
registry/ascii-banner.tsxShows the React banner capability and its relation to the display component
site/…/copy.mdDescribes the user-facing install choices, dependency behavior, and local-copy boundary