# lucasmarkes/hairline architecture

> Architecture diagram of the GitHub repository lucasmarkes/hairline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lucasmarkes/hairline
- Repository: https://github.com/lucasmarkes/hairline

## Overview

Hairline is a dependency-free library of interactive isometric figures, usable through React or directly in a DOM element. The main workflow is a consumer rendering or mounting a figure, which shares pointer and animation infrastructure and draws through the SVG stage. The repository also includes a documentation/showcase site, a shadcn registry component, and a standalone figure-authoring skill. Connections for unsampled subsystems are included only where the README or source index documents them; their internal call paths are not inferred.

Main entry points: [`apps/site/components/catalogue.tsx`](https://github.com/lucasmarkes/hairline/blob/main/apps/site/components/catalogue.tsx) (Figure Catalogue), [`packages/hairline/src/figures`](https://github.com/lucasmarkes/hairline/tree/main/packages/hairline/src/figures) (Figure Engines), [`packages/hairline/src/index.ts`](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/index.ts) (Figure API), [`packages/hairline/src/core/stage.ts`](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/core/stage.ts) (SVG Stage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Figure Runtime"]
  node_react["React Adapter<br/>[react.tsx]"]
  node_api["Figure API<br/>[index.ts]"]
  node_mount["Mount Lifecycle<br/>[mount.ts]"]
  node_engines["Figure Engines"]
  node_stage["SVG Stage<br/>[stage.ts]"]
  node_geometry["Isometric Geometry<br/>[iso.ts]"]
  node_motion["Motion System<br/>[motion.ts]"]
  node_intensity["Intensity Mapping<br/>[intensity.ts]"]
end

subgraph group_site["Showcase Site"]
  node_sitepages["Site Pages"]
  node_catalogueui["Figure Catalogue<br/>[catalogue.tsx]"]
  node_cataloguedata["Catalogue Data<br/>[catalogue.ts]"]
  node_figurecopy["Figure Descriptions<br/>[figures.ts]"]
  node_exampleframes["Example Frames<br/>[example-frame.tsx]"]
  node_llmstext["LLM Reference<br/>[llms.ts]"]
end

subgraph group_registry["shadcn Registry"]
  node_registrycomponent["Registry Component<br/>[hairline.tsx]"]
end

subgraph group_authoring["Figure Authoring"]
  node_skillkernel["Authoring Kernel<br/>[kernel.js]"]
  node_skillbuild["Bench Builder<br/>[build.mjs]"]
  node_skillvalidate["Figure Validator<br/>[validate.mjs]"]
  node_skilllook["Visual Guidance<br/>[look.mjs]"]
end

node_consumer(("App Developer"))
node_sitevisitor(("Site Visitor"))
node_author(("Figure Author"))

node_consumer -->|"renders"| node_react
node_consumer -->|"mounts"| node_api
node_react -->|"wraps"| node_api
node_api -->|"creates"| node_mount
node_api -->|"dispatches"| node_engines
node_mount -->|"sets up"| node_stage
node_mount -->|"normalizes"| node_intensity
node_engines -->|"draws through"| node_stage
node_engines -->|"projects with"| node_geometry
node_engines -->|"animates with"| node_motion
node_motion -->|"clamps using"| node_geometry
node_stage -->|"projects with"| node_geometry
node_stage -->|"tracks preferences"| node_motion
node_sitevisitor -->|"browses"| node_sitepages
node_sitepages -.->|"presents"| node_catalogueui
node_catalogueui -->|"reads entries"| node_cataloguedata
node_catalogueui -->|"reads descriptions"| node_figurecopy
node_catalogueui -->|"renders"| node_exampleframes
node_catalogueui -->|"renders figures"| node_react
node_sitepages -.->|"serves reference"| node_llmstext
node_llmstext -->|"formats"| node_figurecopy
node_registrycomponent -->|"wraps"| node_react
node_author -->|"builds bench"| node_skillbuild
node_skillbuild -->|"embeds"| node_skillkernel
node_author -->|"checks figure"| node_skillvalidate
node_skilllook -.->|"guides authoring"| node_skillbuild

click node_react "https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/react.tsx"
click node_api "https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/index.ts"
click node_mount "https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/mount.ts"
click node_engines "https://github.com/lucasmarkes/hairline/tree/main/packages/hairline/src/figures"
click node_stage "https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/core/stage.ts"
click node_geometry "https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/core/iso.ts"
click node_motion "https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/core/motion.ts"
click node_intensity "https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/intensity.ts"
click node_sitepages "https://github.com/lucasmarkes/hairline/tree/main/apps/site/app"
click node_catalogueui "https://github.com/lucasmarkes/hairline/blob/main/apps/site/components/catalogue.tsx"
click node_cataloguedata "https://github.com/lucasmarkes/hairline/blob/main/apps/site/lib/catalogue.ts"
click node_figurecopy "https://github.com/lucasmarkes/hairline/blob/main/apps/site/lib/figures.ts"
click node_exampleframes "https://github.com/lucasmarkes/hairline/blob/main/apps/site/components/example-frame.tsx"
click node_llmstext "https://github.com/lucasmarkes/hairline/blob/main/apps/site/lib/llms.ts"
click node_registrycomponent "https://github.com/lucasmarkes/hairline/blob/main/registry/src/hairline.tsx"
click node_skillkernel "https://github.com/lucasmarkes/hairline/blob/main/skills/hairline-create/kernel.js"
click node_skillbuild "https://github.com/lucasmarkes/hairline/blob/main/skills/hairline-create/build.mjs"
click node_skillvalidate "https://github.com/lucasmarkes/hairline/blob/main/skills/hairline-create/validate.mjs"
click node_skilllook "https://github.com/lucasmarkes/hairline/blob/main/skills/hairline-create/look.mjs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_react,node_api,node_mount,node_engines,node_stage,node_geometry,node_motion,node_intensity toneBlue
class node_sitepages,node_catalogueui,node_cataloguedata,node_figurecopy,node_exampleframes,node_llmstext toneAmber
class node_registrycomponent toneMint
class node_skillkernel,node_skillbuild,node_skillvalidate,node_skilllook toneRose
class node_consumer,node_sitevisitor,node_author toneIndigo
```

## Components

### Figure Runtime

- [React Adapter](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/react.tsx): `packages/hairline/src/react.tsx`
- [Figure API](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/index.ts): `packages/hairline/src/index.ts`
- [Mount Lifecycle](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/mount.ts): `packages/hairline/src/mount.ts`
- [Figure Engines](https://github.com/lucasmarkes/hairline/tree/main/packages/hairline/src/figures): `packages/hairline/src/figures`
- [SVG Stage](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/core/stage.ts): `packages/hairline/src/core/stage.ts`
- [Isometric Geometry](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/core/iso.ts): `packages/hairline/src/core/iso.ts`
- [Motion System](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/core/motion.ts): `packages/hairline/src/core/motion.ts`
- [Intensity Mapping](https://github.com/lucasmarkes/hairline/blob/main/packages/hairline/src/intensity.ts): `packages/hairline/src/intensity.ts`

### Showcase Site

- [Site Pages](https://github.com/lucasmarkes/hairline/tree/main/apps/site/app): `apps/site/app`
- [Figure Catalogue](https://github.com/lucasmarkes/hairline/blob/main/apps/site/components/catalogue.tsx): `apps/site/components/catalogue.tsx`
- [Catalogue Data](https://github.com/lucasmarkes/hairline/blob/main/apps/site/lib/catalogue.ts): `apps/site/lib/catalogue.ts`
- [Figure Descriptions](https://github.com/lucasmarkes/hairline/blob/main/apps/site/lib/figures.ts): `apps/site/lib/figures.ts`
- [Example Frames](https://github.com/lucasmarkes/hairline/blob/main/apps/site/components/example-frame.tsx): `apps/site/components/example-frame.tsx`
- [LLM Reference](https://github.com/lucasmarkes/hairline/blob/main/apps/site/lib/llms.ts): `apps/site/lib/llms.ts`

### shadcn Registry

- [Registry Component](https://github.com/lucasmarkes/hairline/blob/main/registry/src/hairline.tsx): `registry/src/hairline.tsx`

### Figure Authoring

- [Authoring Kernel](https://github.com/lucasmarkes/hairline/blob/main/skills/hairline-create/kernel.js): `skills/hairline-create/kernel.js`
- [Bench Builder](https://github.com/lucasmarkes/hairline/blob/main/skills/hairline-create/build.mjs): `skills/hairline-create/build.mjs`
- [Figure Validator](https://github.com/lucasmarkes/hairline/blob/main/skills/hairline-create/validate.mjs): `skills/hairline-create/validate.mjs`
- [Visual Guidance](https://github.com/lucasmarkes/hairline/blob/main/skills/hairline-create/look.mjs): `skills/hairline-create/look.mjs`

### Other components

- **App Developer**
- **Site Visitor**
- **Figure Author**

## Connections

- App Developer → React Adapter: renders
- App Developer → Figure API: mounts
- React Adapter → Figure API: wraps (evidence: `packages/hairline/src/react.tsx`)
- Figure API → Mount Lifecycle: creates (evidence: `packages/hairline/src/index.ts`)
- Figure API → Figure Engines: dispatches (evidence: `packages/hairline/src/index.ts`)
- Mount Lifecycle → SVG Stage: sets up (evidence: `packages/hairline/src/mount.ts`)
- Mount Lifecycle → Intensity Mapping: normalizes (evidence: `packages/hairline/src/mount.ts`)
- Figure Engines → SVG Stage: draws through (evidence: `packages/hairline/src/figures/basket.ts`)
- Figure Engines → Isometric Geometry: projects with (evidence: `packages/hairline/src/figures/basket.ts`)
- Figure Engines → Motion System: animates with (evidence: `packages/hairline/src/figures/basket.ts`)
- Motion System → Isometric Geometry: clamps using (evidence: `packages/hairline/src/core/motion.ts`)
- SVG Stage → Isometric Geometry: projects with (evidence: `packages/hairline/src/core/stage.ts`)
- SVG Stage → Motion System: tracks preferences (evidence: `packages/hairline/src/core/stage.ts`)
- Site Visitor → Site Pages: browses
- Site Pages → Figure Catalogue: presents
- Figure Catalogue → Catalogue Data: reads entries (evidence: `apps/site/components/catalogue.tsx`)
- Figure Catalogue → Figure Descriptions: reads descriptions (evidence: `apps/site/components/catalogue.tsx`)
- Figure Catalogue → Example Frames: renders (evidence: `apps/site/components/catalogue.tsx`)
- Figure Catalogue → React Adapter: renders figures (evidence: `apps/site/components/catalogue.tsx`)
- Site Pages → LLM Reference: serves reference
- LLM Reference → Figure Descriptions: formats (evidence: `apps/site/lib/llms.ts`)
- Registry Component → React Adapter: wraps (evidence: `registry/src/hairline.tsx`)
- Figure Author → Bench Builder: builds bench (evidence: `skills/hairline-create/build.mjs`)
- Bench Builder → Authoring Kernel: embeds (evidence: `skills/hairline-create/build.mjs`)
- Figure Author → Figure Validator: checks figure (evidence: `skills/hairline-create/validate.mjs`)
- Visual Guidance → Bench Builder: guides authoring (evidence: `skills/hairline-create/look.mjs`)
