# mmertama/figmaqml architecture

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

- Interactive diagram: https://gitdiagram.com/mmertama/figmaqml
- Repository: https://github.com/mmertama/figmaqml

## Overview

##### Main Components

a) Core Components:
- Figma Interface Layer
- QML Generation Engine
- Platform-Specific Handlers (Desktop/MCU)
- UI Component
- File System Interface

b) External Dependencies:
- Figma API Service
- Qt Framework
- OpenSSL (for secure communications)

**[User Interface Layer]**
- GUI Application (QML-based)
- Command Line Interface

**[Application Layer]**
- FigmaQML Core Engine
- QML Generation Module
- Dynamic Code Handler

**[Platform Adaptation Layer]**
- Desktop Handler
- MCU Handler

**[Integration Layer]**
- Figma API Client
- File System Manager
- Font Cache Manager

**[External Services]**
- Figma API
- Qt Framework

##### Key Relationships to Highlight

a) Data Flow:
- How Figma design data flows from the Figma API through the system
- Transformation process from Figma format to QML
- Demonstrate how generated code is integrated into target applications

b) Component Interactions:
- FigmaQmlInterface's interaction with the main application
- Platform-specific handlers' relationship with the core engine
- Dynamic code generation and loading mechanisms

##### Implementation Details

**[FigmaQmlInterface]**
- ↑↓
**[Core Engine]**
- Parser (figmaparser.h/cpp)
- Provider (figmaprovider.h)
- Converter (figmaconvert.h)
- Document Handler (figmadocument.h)

**[Platform Handlers]**
- Desktop Export
- MCU Export (mcu_figma/)

##### Specific Features to Highlight

- Token-based authentication system
- Multi-view support
- Dynamic component loading
- Font mapping system
- Platform-specific optimizations

##### Integration Points

Clear integration points for:
- Application embedding
- Qt framework integration
- Figma API communication
- File system interaction

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface Layer"
        GUI["GUI Application"]:::ui
        CLI["Command Line Interface"]:::ui
    end

    subgraph "Application Layer"
        FQCore["FigmaQML Core Engine"]:::core
        QMLGen["QML Generation Module"]:::core
        DynCode["Dynamic Code Handler"]:::core
    end

    subgraph "Platform Adaptation Layer"
        Desktop["Desktop Handler"]:::platform
        MCU["MCU Handler"]:::platform
    end

    subgraph "Integration Layer"
        FigmaClient["Figma API Client"]:::integration
        FSManager["File System Manager"]:::integration
        FontCache["Font Cache Manager"]:::integration
    end

    subgraph "External Services"
        FigmaAPI["Figma API"]:::external
        QtFramework["Qt Framework"]:::external
    end

    %% Core Components Detail
    subgraph "Core Components"
        Parser["Parser"]:::component
        Provider["Provider"]:::component
        Converter["Converter"]:::component
        DocHandler["Document Handler"]:::component
    end

    %% Relationships
    GUI --> FQCore
    CLI --> FQCore
    FQCore --> QMLGen
    QMLGen --> DynCode
    DynCode --> Desktop
    DynCode --> MCU
    FQCore --> FigmaClient
    FigmaClient --> FigmaAPI
    FQCore --> FSManager
    FQCore --> FontCache
    Parser --> FQCore
    Provider --> FQCore
    Converter --> FQCore
    DocHandler --> FQCore
    QtFramework -.-> FQCore

    %% Click Events
    click GUI "https://github.com/mmertama/FigmaQML/blob/main/qml/main.qml"
    click FQCore "https://github.com/mmertama/FigmaQML/blob/main/include/figmaqml.h"
    click Parser "https://github.com/mmertama/FigmaQML/blob/main/include/figmaparser.h"
    click Provider "https://github.com/mmertama/FigmaQML/blob/main/include/figmaprovider.h"
    click Converter "https://github.com/mmertama/FigmaQML/blob/main/include/figmaconvert.h"
    click DocHandler "https://github.com/mmertama/FigmaQML/blob/main/include/figmadocument.h"
    click Desktop "https://github.com/mmertama/FigmaQML/tree/main/app_figma"
    click MCU "https://github.com/mmertama/FigmaQML/tree/main/mcu_figma"
    click FSManager "https://github.com/mmertama/FigmaQML/blob/main/include/appwrite.h"
    click FontCache "https://github.com/mmertama/FigmaQML/blob/main/include/fontcache.h"
    click FigmaClient "https://github.com/mmertama/FigmaQML/blob/main/include/figmaget.h"

    %% Styling
    classDef ui fill:#9370DB
    classDef core fill:#4169E1
    classDef platform fill:#FFA500
    classDef integration fill:#6B8E23
    classDef external fill:#808080
    classDef component fill:#4682B4

    %% Legend
    subgraph Legend
        UI[User Interface]:::ui
        Core[Core Components]:::core
        Platform[Platform Specific]:::platform
        Integration[Integration Components]:::integration
        External[External Services]:::external
    end
```
