# mthbrt/leaders-editor architecture

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

- Interactive diagram: https://gitdiagram.com/mthbrt/leaders-editor
- Repository: https://github.com/mthbrt/leaders-editor

## Overview

This is a browser-based hex-board game position editor. Users place and manage pieces from a palette, arrange board state, annotate it with arrows and traps, and use hints/status indicators to assess captures and encirclement. The excerpts establish the editor’s shared board state and the individual feature modules, but not the page’s script-loading or event-wiring details; edges are limited to documented or directly shown relationships.

Main entry points: [`editor.js`](https://github.com/mthbrt/leaders-editor/blob/main/editor.js) (Board editor), [`tooltip.js`](https://github.com/mthbrt/leaders-editor/blob/main/tooltip.js) (Tooltips), [`right_pal.js`](https://github.com/mthbrt/leaders-editor/blob/main/right_pal.js) (Piece palette), [`left_pal.js`](https://github.com/mthbrt/leaders-editor/blob/main/left_pal.js) (Saved positions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_board["Board editing"]
  node_editor["Board editor<br/>[editor.js]"]
end

subgraph group_palettes["Piece palettes"]
  node_leftpal["Saved positions<br/>[left_pal.js]"]
  node_rightpal["Piece palette<br/>[right_pal.js]"]
end

subgraph group_analysis["Position analysis"]
  node_hints["Status hints<br/>[hints.js]"]
end

subgraph group_annotations["Board annotations"]
  node_arrows["Arrow annotations<br/>[arrows.js]"]
end

subgraph group_reference["Piece reference"]
  node_tooltip["Tooltips<br/>[tooltip.js]"]
end

node_user(("Player"))

node_user -->|"edits position"| node_editor
node_editor -->|"defers undo"| node_leftpal
node_editor -->|"provides board state"| node_hints
node_editor -->|"shares board state"| node_arrows
node_editor -->|"schedules tooltips"| node_tooltip
node_rightpal -.->|"shows item details"| node_tooltip

click node_editor "https://github.com/mthbrt/leaders-editor/blob/main/editor.js"
click node_leftpal "https://github.com/mthbrt/leaders-editor/blob/main/left_pal.js"
click node_rightpal "https://github.com/mthbrt/leaders-editor/blob/main/right_pal.js"
click node_hints "https://github.com/mthbrt/leaders-editor/blob/main/hints.js"
click node_arrows "https://github.com/mthbrt/leaders-editor/blob/main/arrows.js"
click node_tooltip "https://github.com/mthbrt/leaders-editor/blob/main/tooltip.js"

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_editor toneBlue
class node_leftpal,node_rightpal toneAmber
class node_hints toneMint
class node_arrows toneRose
class node_tooltip,node_user toneIndigo
```

## Components

### Board editing

- [Board editor](https://github.com/mthbrt/leaders-editor/blob/main/editor.js): `editor.js`

### Piece palettes

- [Saved positions](https://github.com/mthbrt/leaders-editor/blob/main/left_pal.js): `left_pal.js`
- [Piece palette](https://github.com/mthbrt/leaders-editor/blob/main/right_pal.js): `right_pal.js`

### Position analysis

- [Status hints](https://github.com/mthbrt/leaders-editor/blob/main/hints.js): `hints.js`

### Board annotations

- [Arrow annotations](https://github.com/mthbrt/leaders-editor/blob/main/arrows.js): `arrows.js`

### Piece reference

- [Tooltips](https://github.com/mthbrt/leaders-editor/blob/main/tooltip.js): `tooltip.js`

### Other components

- **Player**

## Connections

- Player → Board editor: edits position (evidence: `editor.js`)
- Board editor → Saved positions: defers undo (evidence: `left_pal.js`)
- Board editor → Status hints: provides board state (evidence: `editor.js`)
- Board editor → Arrow annotations: shares board state (evidence: `arrows.js`)
- Board editor → Tooltips: schedules tooltips (evidence: `editor.js`)
- Piece palette → Tooltips: shows item details
