# ming1016/devtools architecture

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

- Interactive diagram: https://gitdiagram.com/ming1016/devtools
- Repository: https://github.com/ming1016/devtools

## Overview

##### Main Components Identification

a. Presentation Layer (Views)
- SwiftUI views in the Views directory
- Hierarchy with MainView as the root
- Specialized views like CodeTextView, FileEditorView, and FileTreeView

b. Business Logic Layer
- FileManager components
- Utils components for syntax highlighting
- Models for data representation

c. Resource Layer
- Assets and configuration files
- Resource files

##### Component Relationships

A. Top Level (Application Entry)
- To ContentView as the main container

B. Core Features (Middle Layer)
Create distinct sections for:

##### File Management System
- FileSystemManager
- SwiftFileProcessor
- To FileItem model

##### Syntax Highlighting System
- SyntaxHighlighter as the base
- Different providers (Swift, XML, Markdown)
- Inheritance relationships

##### View Hierarchy
- MainView as the container
- Relationships between:
- FileTreeView
- FileEditorView
- FunctionListView
- FolderSelectionView

##### Detailed Component Connections

Specific relationships:

##### File Management Flow
**FileSystemManager → SwiftFileProcessor → FileItem**
- ↓
- FileTreeView

##### Code Editing Flow
**FileEditorView → CodeTextView → SyntaxHighlighter**
- ↓
- [HighlightProviders]

##### Function Analysis Flow
**SwiftFileProcessor → FunctionInfo → FunctionListView**

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef view fill:#3498db,stroke:#2980b9,color:white
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef model fill:#f1c40f,stroke:#f39c12,color:black
    classDef util fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef resource fill:#bdc3c7,stroke:#95a5a6,color:black

    %% Application Entry
    DevToolsApp["DevToolsApp"]:::view
    ContentView["ContentView"]:::view

    %% Main Views
    MainView["MainView"]:::view
    CodeTextView["CodeTextView"]:::view
    FileEditorView["FileEditorView"]:::view
    FileTreeView["FileTreeView"]:::view
    FunctionListView["FunctionListView"]:::view
    FolderSelectionView["FolderSelectionView"]:::view

    %% Services
    FileSystemManager["FileSystemManager"]:::service
    SwiftFileProcessor["SwiftFileProcessor"]:::service

    %% Models
    FileItem["FileItem"]:::model
    FunctionInfo["FunctionInfo"]:::model

    %% Utils
    SyntaxHighlighter["SyntaxHighlighter"]:::util
    HighlightProvider["HighlightProvider Base"]:::util
    SwiftProvider["Swift Provider"]:::util
    XMLProvider["XML Provider"]:::util
    MarkdownProvider["Markdown Provider"]:::util

    %% Resources
    Assets["Assets"]:::resource
    ResourceFiles["Resource Files"]:::resource

    %% Relationships
    DevToolsApp --> ContentView
    ContentView --> MainView
    MainView --> FileTreeView
    MainView --> FileEditorView
    MainView --> FunctionListView
    MainView --> FolderSelectionView
    
    FileEditorView --> CodeTextView
    CodeTextView --> SyntaxHighlighter
    
    SyntaxHighlighter --> HighlightProvider
    HighlightProvider --> SwiftProvider
    HighlightProvider --> XMLProvider
    HighlightProvider --> MarkdownProvider
    
    FileSystemManager --> SwiftFileProcessor
    SwiftFileProcessor --> FileItem
    SwiftFileProcessor --> FunctionInfo
    
    FileTreeView --> FileSystemManager
    FunctionListView --> FunctionInfo
    
    %% Click Events
    click DevToolsApp "https://github.com/ming1016/DevTools/blob/main/DevTools/DevToolsApp.swift"
    click ContentView "https://github.com/ming1016/DevTools/blob/main/DevTools/ContentView.swift"
    click MainView "https://github.com/ming1016/DevTools/blob/main/DevTools/Views/MainView.swift"
    click CodeTextView "https://github.com/ming1016/DevTools/blob/main/DevTools/Views/CodeTextView.swift"
    click FileEditorView "https://github.com/ming1016/DevTools/blob/main/DevTools/Views/FileEditorView.swift"
    click FileTreeView "https://github.com/ming1016/DevTools/blob/main/DevTools/Views/FileTreeView.swift"
    click FunctionListView "https://github.com/ming1016/DevTools/blob/main/DevTools/Views/FunctionListView.swift"
    click FolderSelectionView "https://github.com/ming1016/DevTools/blob/main/DevTools/Views/FolderSelectionView.swift"
    click FileSystemManager "https://github.com/ming1016/DevTools/blob/main/DevTools/FileManager/FileSystemManager.swift"
    click SwiftFileProcessor "https://github.com/ming1016/DevTools/blob/main/DevTools/FileManager/SwiftFileProcessor.swift"
    click SyntaxHighlighter "https://github.com/ming1016/DevTools/blob/main/DevTools/Utils/SyntaxHighlighter.swift"
    click HighlightProvider "https://github.com/ming1016/DevTools/blob/main/DevTools/Utils/HighlightProvider.swift"
    click SwiftProvider "https://github.com/ming1016/DevTools/blob/main/DevTools/Utils/SwiftHighlightProvider.swift"
    click XMLProvider "https://github.com/ming1016/DevTools/blob/main/DevTools/Utils/XMLHighlightProvider.swift"
    click MarkdownProvider "https://github.com/ming1016/DevTools/blob/main/DevTools/Utils/MarkdownHighlightProvider.swift"
    click FileItem "https://github.com/ming1016/DevTools/blob/main/DevTools/Models/FileItem.swift"
    click FunctionInfo "https://github.com/ming1016/DevTools/blob/main/DevTools/Models/FuntionInfo.swift"
    click Assets "https://github.com/ming1016/DevTools/blob/main/DevTools/Assets.xcassets"
    click ResourceFiles "https://github.com/ming1016/DevTools/tree/main/DevTools/Resource/TimeTrackerFunctionCostCode"

    %% Legend
    subgraph Legend
        View["View Component"]:::view
        Service["Service Component"]:::service
        Model["Data Model"]:::model
        Utility["Utility Component"]:::util
        Resource["Resource"]:::resource
    end
```
