# zorkai/yunotes architecture

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

- Interactive diagram: https://gitdiagram.com/zorkai/yunotes
- Repository: https://github.com/zorkai/yunotes

## Overview

YuNotes is a Windows digital notebook for creating and editing pen-based notes, with PDF/PNG interchange and configurable input. The main workflow is HomePage document selection or creation, then EditorPage edits through canvas tools, rendering, and document persistence; settings configure the experience separately. The graph includes documented selection, templates, input handling, and export capabilities. Some subsystem paths and their wiring are only documented in the README, so those links are marked unverified where source evidence was unavailable.

Main entry points: [`src/YuNotes/Views/EditorPage.xaml.cs`](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Views/EditorPage.xaml.cs) (Editor workspace), [`src/YuNotes/Controls/PageCanvas.cs`](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Controls/PageCanvas.cs) (Page canvas), [`src/YuNotes/Tools/EditorContext.cs`](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/EditorContext.cs) (Editor state and bounds), [`src/YuNotes/Controls/InkCanvasControl.xaml.cs`](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Controls/InkCanvasControl.xaml.cs) (Ink input control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App and navigation"]
  node_home["Home and recents<br/>[HomePage.xaml.cs]"]
  node_editor["Editor workspace<br/>[EditorPage.xaml.cs]"]
  node_settingsview["Settings screen"]
end

subgraph group_editing["Canvas and editing"]
  node_canvascontrol["Ink input control"]
  node_pagecanvas["Page canvas<br/>[PageCanvas.cs]"]
  node_liveink["Live ink surface<br/>[LiveInkSurface.cs]"]
  node_tools["Pen and highlighter<br/>[PenTool.cs]"]
  node_eraser["Stroke and pixel eraser<br/>[EraserTool.cs]"]
  node_selection["Lasso and rectangle selection<br/>[SelectionTools.cs]"]
  node_shape["Shape tools and recognition<br/>[ShapeTool.cs]"]
  node_texttool["Text editing<br/>[TextTool.cs]"]
  node_context["Editor state and bounds<br/>[EditorContext.cs]"]
  node_renderer["Page renderer<br/>[PageRenderer.cs]"]
  node_templates["Page templates<br/>[TemplateService.cs]"]
end

subgraph group_data["Documents and persistence"]
  node_documentmodel["Document and page model<br/>[Document.cs]"]
  node_stroke["Editable ink and elements<br/>[Stroke.cs]"]
  node_docservice[("Document persistence<br/>[DocumentService.cs]")]
  node_history["Undo and redo history<br/>[HistoryService.cs]"]
end

subgraph group_interop["Import and export"]
  node_pdfcontainer["PDF note container"]
  node_pdfimport["PDF import"]
  node_pdfexport["PDF export"]
  node_pngexport["PNG export"]
end

subgraph group_config["Input and settings"]
  node_settings["App settings model<br/>[AppSettings.cs]"]
  node_settingsservice["Settings persistence<br/>[SettingsService.cs]"]
  node_palm["Palm rejection<br/>[PalmRejection.cs]"]
  node_penrouter["Pen button routing<br/>[PenButtonRouter.cs]"]
end

node_user(("Notebook user"))

node_user -->|"opens notebook"| node_home
node_home -.->|"opens document"| node_editor
node_user -->|"configures app"| node_settingsview
node_editor -.->|"hosts canvas"| node_canvascontrol
node_editor -->|"loads and saves"| node_docservice
node_editor -->|"selects tools"| node_tools
node_editor -->|"selects tools"| node_eraser
node_editor -->|"selects tools"| node_texttool
node_editor -->|"selects tools"| node_shape
node_canvascontrol -->|"hosts canvas"| node_pagecanvas
node_canvascontrol -->|"updates state"| node_context
node_canvascontrol -->|"filters touch"| node_palm
node_canvascontrol -->|"routes buttons"| node_penrouter
node_pagecanvas -->|"updates state"| node_context
node_pagecanvas -->|"hosts overlay"| node_liveink
node_pagecanvas -->|"draws page"| node_renderer
node_pagecanvas -->|"dispatches input"| node_tools
node_pagecanvas -->|"dispatches input"| node_eraser
node_pagecanvas -->|"dispatches input"| node_shape
node_tools -->|"mutates state"| node_context
node_tools -->|"creates strokes"| node_stroke
node_tools -->|"snaps strokes"| node_shape
node_eraser -->|"edits state"| node_context
node_selection -->|"updates selection"| node_context
node_shape -->|"edits state"| node_context
node_texttool -->|"edits state"| node_context
node_renderer -->|"draws backgrounds"| node_templates
node_renderer -->|"renders elements"| node_stroke
node_docservice -->|"loads and writes"| node_documentmodel
node_docservice -->|"imports PDF"| node_pdfimport
node_docservice -->|"reads embedded data"| node_pdfcontainer
node_documentmodel -->|"contains editable content"| node_stroke
node_settingsview -.->|"persists preferences"| node_settingsservice
node_settingsservice -->|"loads and saves"| node_settings
node_palm -->|"reads thresholds"| node_settings
node_penrouter -->|"reads bindings"| node_settings
node_editor -.->|"offers selection"| node_selection
node_editor -.->|"exports PDF"| node_pdfexport
node_editor -.->|"exports PNG"| node_pngexport
node_docservice -.->|"tracks edits"| node_history

click node_home "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Views/HomePage.xaml.cs"
click node_editor "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Views/EditorPage.xaml.cs"
click node_settingsview "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Views/SettingsPage.xaml.cs"
click node_canvascontrol "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Controls/InkCanvasControl.xaml.cs"
click node_pagecanvas "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Controls/PageCanvas.cs"
click node_liveink "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Controls/LiveInkSurface.cs"
click node_tools "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/PenTool.cs"
click node_eraser "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/EraserTool.cs"
click node_selection "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/SelectionTools.cs"
click node_shape "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/ShapeTool.cs"
click node_texttool "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/TextTool.cs"
click node_context "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/EditorContext.cs"
click node_renderer "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Rendering/PageRenderer.cs"
click node_templates "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/TemplateService.cs"
click node_documentmodel "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Models/Document.cs"
click node_stroke "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Models/Stroke.cs"
click node_docservice "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/DocumentService.cs"
click node_history "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/HistoryService.cs"
click node_pdfcontainer "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/PdfContainerService.cs"
click node_pdfimport "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/PdfImportService.cs"
click node_pdfexport "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/PdfExportService.cs"
click node_pngexport "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/PngExportService.cs"
click node_settings "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Models/AppSettings.cs"
click node_settingsservice "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/SettingsService.cs"
click node_palm "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Input/PalmRejection.cs"
click node_penrouter "https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Input/PenButtonRouter.cs"

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_home,node_editor,node_settingsview,node_user toneBlue
class node_canvascontrol,node_pagecanvas,node_liveink,node_tools,node_eraser,node_selection,node_shape,node_texttool,node_context,node_renderer,node_templates toneAmber
class node_documentmodel,node_stroke,node_docservice,node_history toneMint
class node_pdfcontainer,node_pdfimport,node_pdfexport,node_pngexport toneRose
class node_settings,node_settingsservice,node_palm,node_penrouter toneIndigo
```

## Components

### App and navigation

- [Home and recents](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Views/HomePage.xaml.cs): `src/YuNotes/Views/HomePage.xaml.cs`
- [Editor workspace](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Views/EditorPage.xaml.cs): `src/YuNotes/Views/EditorPage.xaml.cs`
- [Settings screen](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Views/SettingsPage.xaml.cs): `src/YuNotes/Views/SettingsPage.xaml.cs`

### Canvas and editing

- [Ink input control](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Controls/InkCanvasControl.xaml.cs): `src/YuNotes/Controls/InkCanvasControl.xaml.cs`
- [Page canvas](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Controls/PageCanvas.cs): `src/YuNotes/Controls/PageCanvas.cs`
- [Live ink surface](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Controls/LiveInkSurface.cs): `src/YuNotes/Controls/LiveInkSurface.cs`
- [Pen and highlighter](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/PenTool.cs): `src/YuNotes/Tools/PenTool.cs`
- [Stroke and pixel eraser](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/EraserTool.cs): `src/YuNotes/Tools/EraserTool.cs`
- [Lasso and rectangle selection](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/SelectionTools.cs): `src/YuNotes/Tools/SelectionTools.cs`
- [Shape tools and recognition](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/ShapeTool.cs): `src/YuNotes/Tools/ShapeTool.cs`
- [Text editing](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/TextTool.cs): `src/YuNotes/Tools/TextTool.cs`
- [Editor state and bounds](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Tools/EditorContext.cs): `src/YuNotes/Tools/EditorContext.cs`
- [Page renderer](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Rendering/PageRenderer.cs): `src/YuNotes/Rendering/PageRenderer.cs`
- [Page templates](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/TemplateService.cs): `src/YuNotes/Services/TemplateService.cs`

### Documents and persistence

- [Document and page model](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Models/Document.cs): `src/YuNotes/Models/Document.cs`
- [Editable ink and elements](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Models/Stroke.cs): `src/YuNotes/Models/Stroke.cs`
- [Document persistence](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/DocumentService.cs): `src/YuNotes/Services/DocumentService.cs`
- [Undo and redo history](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/HistoryService.cs): `src/YuNotes/Services/HistoryService.cs`

### Import and export

- [PDF note container](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/PdfContainerService.cs): `src/YuNotes/Services/PdfContainerService.cs`
- [PDF import](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/PdfImportService.cs): `src/YuNotes/Services/PdfImportService.cs`
- [PDF export](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/PdfExportService.cs): `src/YuNotes/Services/PdfExportService.cs`
- [PNG export](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/PngExportService.cs): `src/YuNotes/Services/PngExportService.cs`

### Input and settings

- [App settings model](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Models/AppSettings.cs): `src/YuNotes/Models/AppSettings.cs`
- [Settings persistence](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Services/SettingsService.cs): `src/YuNotes/Services/SettingsService.cs`
- [Palm rejection](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Input/PalmRejection.cs): `src/YuNotes/Input/PalmRejection.cs`
- [Pen button routing](https://github.com/zorkai/yunotes/blob/main/src/YuNotes/Input/PenButtonRouter.cs): `src/YuNotes/Input/PenButtonRouter.cs`

### Other components

- **Notebook user**

## Connections

- Notebook user → Home and recents: opens notebook
- Home and recents → Editor workspace: opens document
- Notebook user → Settings screen: configures app
- Editor workspace → Ink input control: hosts canvas
- Editor workspace → Document persistence: loads and saves (evidence: `src/YuNotes/Views/EditorPage.xaml.cs`)
- Editor workspace → Pen and highlighter: selects tools (evidence: `src/YuNotes/Views/EditorPage.xaml.cs`)
- Editor workspace → Stroke and pixel eraser: selects tools (evidence: `src/YuNotes/Views/EditorPage.xaml.cs`)
- Editor workspace → Text editing: selects tools (evidence: `src/YuNotes/Views/EditorPage.xaml.cs`)
- Editor workspace → Shape tools and recognition: selects tools (evidence: `src/YuNotes/Views/EditorPage.xaml.cs`)
- Ink input control → Page canvas: hosts canvas (evidence: `src/YuNotes/Controls/InkCanvasControl.xaml.cs`)
- Ink input control → Editor state and bounds: updates state (evidence: `src/YuNotes/Controls/InkCanvasControl.xaml.cs`)
- Ink input control → Palm rejection: filters touch (evidence: `src/YuNotes/Controls/InkCanvasControl.xaml.cs`)
- Ink input control → Pen button routing: routes buttons (evidence: `src/YuNotes/Controls/InkCanvasControl.xaml.cs`)
- Page canvas → Editor state and bounds: updates state (evidence: `src/YuNotes/Controls/PageCanvas.cs`)
- Page canvas → Live ink surface: hosts overlay (evidence: `src/YuNotes/Controls/PageCanvas.cs`)
- Page canvas → Page renderer: draws page (evidence: `src/YuNotes/Controls/PageCanvas.cs`)
- Page canvas → Pen and highlighter: dispatches input (evidence: `src/YuNotes/Controls/PageCanvas.cs`)
- Page canvas → Stroke and pixel eraser: dispatches input (evidence: `src/YuNotes/Controls/PageCanvas.cs`)
- Page canvas → Shape tools and recognition: dispatches input (evidence: `src/YuNotes/Controls/PageCanvas.cs`)
- Pen and highlighter → Editor state and bounds: mutates state (evidence: `src/YuNotes/Tools/PenTool.cs`)
- Pen and highlighter → Editable ink and elements: creates strokes (evidence: `src/YuNotes/Tools/PenTool.cs`)
- Pen and highlighter → Shape tools and recognition: snaps strokes (evidence: `src/YuNotes/Tools/PenTool.cs`)
- Stroke and pixel eraser → Editor state and bounds: edits state (evidence: `src/YuNotes/Tools/EraserTool.cs`)
- Lasso and rectangle selection → Editor state and bounds: updates selection (evidence: `src/YuNotes/Tools/SelectionTools.cs`)
- Shape tools and recognition → Editor state and bounds: edits state (evidence: `src/YuNotes/Tools/ShapeTool.cs`)
- Text editing → Editor state and bounds: edits state (evidence: `src/YuNotes/Tools/TextTool.cs`)
- Page renderer → Page templates: draws backgrounds (evidence: `src/YuNotes/Rendering/PageRenderer.cs`)
- Page renderer → Editable ink and elements: renders elements (evidence: `src/YuNotes/Rendering/PageRenderer.cs`)
- Document persistence → Document and page model: loads and writes (evidence: `src/YuNotes/Services/DocumentService.cs`)
- Document persistence → PDF import: imports PDF (evidence: `src/YuNotes/Services/DocumentService.cs`)
- Document persistence → PDF note container: reads embedded data (evidence: `src/YuNotes/Services/DocumentService.cs`)
- Document and page model → Editable ink and elements: contains editable content (evidence: `src/YuNotes/Models/Document.cs`)
- Settings screen → Settings persistence: persists preferences
- Settings persistence → App settings model: loads and saves (evidence: `src/YuNotes/Services/SettingsService.cs`)
- Palm rejection → App settings model: reads thresholds (evidence: `src/YuNotes/Input/PalmRejection.cs`)
- Pen button routing → App settings model: reads bindings (evidence: `src/YuNotes/Input/PenButtonRouter.cs`)
- Editor workspace → Lasso and rectangle selection: offers selection
- Editor workspace → PDF export: exports PDF
- Editor workspace → PNG export: exports PNG
- Document persistence → Undo and redo history: tracks edits
