# sadsnake1/cursor-smith architecture

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

- Interactive diagram: https://gitdiagram.com/sadsnake1/cursor-smith
- Repository: https://github.com/sadsnake1/cursor-smith

## Overview

Cursor-Smith is an Obsidian plugin that replaces and animates the caret. Its main user-to-result path is enabling/configuring the plugin, tracking caret positions in editors and other editable surfaces, then drawing the configured cursor and effects on a canvas. Settings also support presets, share codes, Vim-specific looks, and commands; effect modules cover the README’s distinct visual features. The sampled code confirms the plugin/settings and several internal dependencies, but does not expose all runtime wiring, so uncertain call edges are omitted.

Main entry points: [`src/plugin.ts`](https://github.com/sadsnake1/cursor-smith/blob/main/src/plugin.ts) (Plugin lifecycle), [`src/settings-tab.ts`](https://github.com/sadsnake1/cursor-smith/blob/main/src/settings-tab.ts) (Settings panel), [`src/effects.ts`](https://github.com/sadsnake1/cursor-smith/blob/main/src/effects.ts) (Effect dispatch), [`src/effects-fire.ts`](https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-fire.ts) (Hot-head flames)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Plugin integration"]
  node_entry["Plugin entry<br/>[main.ts]"]
  node_plugin["Plugin lifecycle<br/>[plugin.ts]"]
  node_vim["Vim integration<br/>[vim.ts]"]
end

subgraph group_tracking["Caret tracking"]
  node_carets["Caret state<br/>[carets.ts]"]
  node_measure["Caret measurement<br/>[measure.ts]"]
  node_motion["Motion behavior<br/>[motion.ts]"]
end

subgraph group_rendering["Canvas rendering"]
  node_engine["Canvas engine<br/>[engine.ts]"]
  node_geometry["Canvas geometry<br/>[geometry.ts]"]
  node_paint["Cursor painting<br/>[paint.ts]"]
  node_paintshape["Shape and color<br/>[paint-shape.ts]"]
  node_paintframe["Frame effects<br/>[paint-frame.ts]"]
  node_color["Color utilities<br/>[color.ts]"]
end

subgraph group_configuration["Settings and presets"]
  node_settingsui["Settings panel<br/>[settings-tab.ts]"]
  node_settings["Settings model<br/>[settings.ts]"]
  node_presets["Preset catalog<br/>[presets.ts]"]
  node_sharing["Preset sharing<br/>[share.ts]"]
end

subgraph group_effects["Visual effects"]
  node_effectscore["Effect dispatch<br/>[effects.ts]"]
  node_pops["Pop and fireworks<br/>[effects-pops.ts]"]
  node_trail["Particle trails<br/>[effects-trail.ts]"]
  node_dust["Stardust<br/>[effects-dust.ts]"]
  node_torch["Torch spotlight<br/>[torch.ts]"]
  node_torchpaint["Torch painting<br/>[torch-paint.ts]"]
  node_fire["Hot-head flames<br/>[effects-fire.ts]"]
  node_firemodel["Fire behavior<br/>[fire.ts]"]
end

node_user(("Obsidian user"))
node_obsidian["Obsidian APIs"]

node_user -->|"uses"| node_obsidian
node_obsidian -->|"loads plugin"| node_entry
node_entry -->|"exports"| node_plugin
node_plugin -->|"uses APIs"| node_obsidian
node_plugin -->|"creates panel"| node_settingsui
node_plugin -->|"migrates settings"| node_settings
node_plugin -->|"applies motion policy"| node_motion
node_plugin -->|"integrates Vim"| node_vim
node_settingsui -->|"reads configuration"| node_settings
node_settingsui -->|"offers presets"| node_presets
node_settingsui -->|"encodes share codes"| node_sharing
node_settingsui -->|"uses UI APIs"| node_obsidian
node_plugin -->|"runs canvas engine"| node_engine
node_engine -->|"fits canvas region"| node_geometry
node_measure -->|"checks caret host"| node_motion
node_effectscore -->|"dispatches pop effects"| node_pops
node_effectscore -->|"dispatches trails"| node_trail
node_effectscore -->|"dispatches dust"| node_dust
node_effectscore -->|"dispatches flames"| node_fire
node_fire -->|"quantizes fire"| node_firemodel
node_pops -->|"uses colors"| node_color
node_fire -->|"uses colors"| node_color

click node_entry "https://github.com/sadsnake1/cursor-smith/blob/main/src/main.ts"
click node_plugin "https://github.com/sadsnake1/cursor-smith/blob/main/src/plugin.ts"
click node_vim "https://github.com/sadsnake1/cursor-smith/blob/main/src/vim.ts"
click node_settingsui "https://github.com/sadsnake1/cursor-smith/blob/main/src/settings-tab.ts"
click node_settings "https://github.com/sadsnake1/cursor-smith/blob/main/src/settings.ts"
click node_presets "https://github.com/sadsnake1/cursor-smith/blob/main/src/presets.ts"
click node_sharing "https://github.com/sadsnake1/cursor-smith/blob/main/src/share.ts"
click node_carets "https://github.com/sadsnake1/cursor-smith/blob/main/src/carets.ts"
click node_measure "https://github.com/sadsnake1/cursor-smith/blob/main/src/measure.ts"
click node_motion "https://github.com/sadsnake1/cursor-smith/blob/main/src/motion.ts"
click node_engine "https://github.com/sadsnake1/cursor-smith/blob/main/src/engine.ts"
click node_geometry "https://github.com/sadsnake1/cursor-smith/blob/main/src/geometry.ts"
click node_paint "https://github.com/sadsnake1/cursor-smith/blob/main/src/paint.ts"
click node_paintshape "https://github.com/sadsnake1/cursor-smith/blob/main/src/paint-shape.ts"
click node_paintframe "https://github.com/sadsnake1/cursor-smith/blob/main/src/paint-frame.ts"
click node_effectscore "https://github.com/sadsnake1/cursor-smith/blob/main/src/effects.ts"
click node_pops "https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-pops.ts"
click node_trail "https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-trail.ts"
click node_dust "https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-dust.ts"
click node_torch "https://github.com/sadsnake1/cursor-smith/blob/main/src/torch.ts"
click node_torchpaint "https://github.com/sadsnake1/cursor-smith/blob/main/src/torch-paint.ts"
click node_fire "https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-fire.ts"
click node_firemodel "https://github.com/sadsnake1/cursor-smith/blob/main/src/fire.ts"
click node_color "https://github.com/sadsnake1/cursor-smith/blob/main/src/color.ts"

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_entry,node_plugin,node_vim,node_user toneBlue
class node_carets,node_measure,node_motion toneAmber
class node_engine,node_geometry,node_paint,node_paintshape,node_paintframe,node_color,node_obsidian toneMint
class node_settingsui,node_settings,node_presets,node_sharing toneRose
class node_effectscore,node_pops,node_trail,node_dust,node_torch,node_torchpaint,node_fire,node_firemodel toneIndigo
```

## Components

### Plugin integration

- [Plugin entry](https://github.com/sadsnake1/cursor-smith/blob/main/src/main.ts): `src/main.ts`
- [Plugin lifecycle](https://github.com/sadsnake1/cursor-smith/blob/main/src/plugin.ts): `src/plugin.ts`
- [Vim integration](https://github.com/sadsnake1/cursor-smith/blob/main/src/vim.ts): `src/vim.ts`

### Caret tracking

- [Caret state](https://github.com/sadsnake1/cursor-smith/blob/main/src/carets.ts): `src/carets.ts`
- [Caret measurement](https://github.com/sadsnake1/cursor-smith/blob/main/src/measure.ts): `src/measure.ts`
- [Motion behavior](https://github.com/sadsnake1/cursor-smith/blob/main/src/motion.ts): `src/motion.ts`

### Canvas rendering

- [Canvas engine](https://github.com/sadsnake1/cursor-smith/blob/main/src/engine.ts): `src/engine.ts`
- [Canvas geometry](https://github.com/sadsnake1/cursor-smith/blob/main/src/geometry.ts): `src/geometry.ts`
- [Cursor painting](https://github.com/sadsnake1/cursor-smith/blob/main/src/paint.ts): `src/paint.ts`
- [Shape and color](https://github.com/sadsnake1/cursor-smith/blob/main/src/paint-shape.ts): `src/paint-shape.ts`
- [Frame effects](https://github.com/sadsnake1/cursor-smith/blob/main/src/paint-frame.ts): `src/paint-frame.ts`
- [Color utilities](https://github.com/sadsnake1/cursor-smith/blob/main/src/color.ts): `src/color.ts`

### Settings and presets

- [Settings panel](https://github.com/sadsnake1/cursor-smith/blob/main/src/settings-tab.ts): `src/settings-tab.ts`
- [Settings model](https://github.com/sadsnake1/cursor-smith/blob/main/src/settings.ts): `src/settings.ts`
- [Preset catalog](https://github.com/sadsnake1/cursor-smith/blob/main/src/presets.ts): `src/presets.ts`
- [Preset sharing](https://github.com/sadsnake1/cursor-smith/blob/main/src/share.ts): `src/share.ts`

### Visual effects

- [Effect dispatch](https://github.com/sadsnake1/cursor-smith/blob/main/src/effects.ts): `src/effects.ts`
- [Pop and fireworks](https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-pops.ts): `src/effects-pops.ts`
- [Particle trails](https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-trail.ts): `src/effects-trail.ts`
- [Stardust](https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-dust.ts): `src/effects-dust.ts`
- [Torch spotlight](https://github.com/sadsnake1/cursor-smith/blob/main/src/torch.ts): `src/torch.ts`
- [Torch painting](https://github.com/sadsnake1/cursor-smith/blob/main/src/torch-paint.ts): `src/torch-paint.ts`
- [Hot-head flames](https://github.com/sadsnake1/cursor-smith/blob/main/src/effects-fire.ts): `src/effects-fire.ts`
- [Fire behavior](https://github.com/sadsnake1/cursor-smith/blob/main/src/fire.ts): `src/fire.ts`

### Other components

- **Obsidian user**
- **Obsidian APIs**

## Connections

- Obsidian user → Obsidian APIs: uses
- Obsidian APIs → Plugin entry: loads plugin
- Plugin entry → Plugin lifecycle: exports
- Plugin lifecycle → Obsidian APIs: uses APIs
- Plugin lifecycle → Settings panel: creates panel
- Plugin lifecycle → Settings model: migrates settings
- Plugin lifecycle → Motion behavior: applies motion policy
- Plugin lifecycle → Vim integration: integrates Vim
- Settings panel → Settings model: reads configuration
- Settings panel → Preset catalog: offers presets
- Settings panel → Preset sharing: encodes share codes
- Settings panel → Obsidian APIs: uses UI APIs
- Plugin lifecycle → Canvas engine: runs canvas engine
- Canvas engine → Canvas geometry: fits canvas region
- Caret measurement → Motion behavior: checks caret host
- Effect dispatch → Pop and fireworks: dispatches pop effects
- Effect dispatch → Particle trails: dispatches trails
- Effect dispatch → Stardust: dispatches dust
- Effect dispatch → Hot-head flames: dispatches flames
- Hot-head flames → Fire behavior: quantizes fire
- Pop and fireworks → Color utilities: uses colors
- Hot-head flames → Color utilities: uses colors
