# thetronjohnson/slate architecture

> Architecture diagram of the GitHub repository thetronjohnson/slate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thetronjohnson/slate
- Repository: https://github.com/thetronjohnson/slate

## Overview

##### Main System Components

a) Application Layer
- Electron Main Process (Host Application)
- Electron Renderer Process (Web Application)
- IPC (Inter-Process Communication) Bridge

b) Frontend Components
- Editor Interface
- File Management System
- Preview System
- Image Handling System

##### Detailed Component Breakdown

A. Electron Container (Outer boundary)
- Main Process (electron/main.js)
- Workspace Protocol Handler
- File System Access
- Window Management

B. Renderer Process (Inner container)
- Vue.js Application Layer
- Components Layer
- MarkdownEditor (Core Editor)
- FileTree Management
- Dialogs System (Images, Links)
- TitleBar & Toolbars
- State Management Layer
- Composables
- useWorkspace
- useEditor
- useCurrentFile

C. Data Flow Layer
- File System Integration
- Image Processing
- Markdown Processing
- PDF Export Pipeline

##### Key Relationships to Highlight

- Main Process ↔ Renderer Process communication
- Editor Component ↔ File System interactions
- Image Handling flow
- Preview rendering pipeline
- Workspace protocol implementation

##### Technical Stack Integration

A stack layer showing:
- Electron (Application Container)
- Vue 3 + Nuxt 3 (Frontend Framework)
- TipTap (Editor Engine)
- Tailwind CSS (Styling)

##### Component Relationships

Key interactions:
**Electron Main Process**
- ↕ (IPC)
**Vue Application (app.vue)**
- ↓
**MarkdownEditor Component**
- ↙     ↓     ↘
**FileTree  Editor  Preview**
- ↓
**Workspace Management**

##### Additional Elements

Include:
- Version information
- External dependency connections
- Build pipeline overview

Remember to:
- Keep the main workflow clear and centered
- Related components visually
- Use consistent styling for similar components
- Major integration points
- Error handling paths
- Asynchronous operations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Electron
        MainProcess["Main Process"]
        IPC["IPC Bridge"]
        WinMgmt["Window Management"]
        FSAccess["File System Access"]
        Protocol["Workspace Protocol"]
    end

    subgraph "Vue Application"
        App["App Entry"]
        
        subgraph "Components"
            Editor["Markdown Editor"]
            FileTree["File Tree"]
            TitleBar["Title Bar"]
            FloatBar["Floating Toolbar"]
            Context["Context Menu"]
            Splash["Splash Screen"]
            
            subgraph "Dialog System"
                ImgDialog["Image Dialog"]
                LinkDialog["Link Dialog"]
                AltDialog["Alt Text Dialog"]
                EditDialog["Image Edit Dialog"]
                UrlDialog["Image URL Dialog"]
            end
        end
        
        subgraph "State Management"
            Workspace["useWorkspace"]
            EditorState["useEditor"]
            CurrentFile["useCurrentFile"]
        end
    end

    subgraph "Core Systems"
        ImgHandler["Image Handler"]
        StyleSystem["Styling System"]
        Icons["Application Icons"]
    end

    MainProcess --> IPC
    IPC --> App
    MainProcess --> WinMgmt
    MainProcess --> FSAccess
    MainProcess --> Protocol
    
    App --> Editor
    App --> FileTree
    App --> TitleBar
    App --> FloatBar
    App --> Context
    App --> Splash
    
    Editor --> ImgHandler
    Editor --> StyleSystem
    
    FileTree --> Workspace
    Editor --> EditorState
    Editor --> CurrentFile

    %% Click Events
    click MainProcess "https://github.com/thetronjohnson/slate/blob/main/electron/main.js"
    click App "https://github.com/thetronjohnson/slate/blob/main/app.vue"
    click Editor "https://github.com/thetronjohnson/slate/blob/main/components/MarkdownEditor.vue"
    click FileTree "https://github.com/thetronjohnson/slate/blob/main/components/FileTreeItem.vue"
    click TitleBar "https://github.com/thetronjohnson/slate/blob/main/components/TitleBar.vue"
    click FloatBar "https://github.com/thetronjohnson/slate/blob/main/components/FloatingToolbar.vue"
    click ImgHandler "https://github.com/thetronjohnson/slate/blob/main/utils/images.ts"
    click ImgDialog "https://github.com/thetronjohnson/slate/blob/main/components/ImageDialog.vue"
    click LinkDialog "https://github.com/thetronjohnson/slate/blob/main/components/LinkDialog.vue"
    click AltDialog "https://github.com/thetronjohnson/slate/blob/main/components/ImageAltTextDialog.vue"
    click EditDialog "https://github.com/thetronjohnson/slate/blob/main/components/ImageEditDialog.vue"
    click UrlDialog "https://github.com/thetronjohnson/slate/blob/main/components/ImageUrlDialog.vue"
    click Workspace "https://github.com/thetronjohnson/slate/blob/main/composables/useWorkspace.ts"
    click EditorState "https://github.com/thetronjohnson/slate/blob/main/composables/useEditor.ts"
    click CurrentFile "https://github.com/thetronjohnson/slate/blob/main/composables/useCurrentFile.ts"
    click StyleSystem "https://github.com/thetronjohnson/slate/tree/main/assets/styles"
    click Icons "https://github.com/thetronjohnson/slate/blob/main/electron/icons/icon.icns"
    click Context "https://github.com/thetronjohnson/slate/blob/main/components/EditorContextMenu.vue"
    click Splash "https://github.com/thetronjohnson/slate/blob/main/components/SplashScreen.vue"

    %% Styling
    classDef electron fill:#a5d8ff,stroke:#0077cc
    classDef vue fill:#42b883,stroke:#35495e
    classDef component fill:#34d399,stroke:#059669
    classDef state fill:#fbbf24,stroke:#d97706
    classDef system fill:#818cf8,stroke:#4f46e5
    classDef dialog fill:#f472b6,stroke:#db2777

    class MainProcess,IPC,WinMgmt,FSAccess,Protocol electron
    class App,Components vue
    class Editor,FileTree,TitleBar,FloatBar,Context,Splash component
    class Workspace,EditorState,CurrentFile state
    class ImgHandler,StyleSystem,Icons system
    class ImgDialog,LinkDialog,AltDialog,EditDialog,UrlDialog dialog
```
