# jeasoon-osp/lutpreviewer architecture

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

- Interactive diagram: https://gitdiagram.com/jeasoon-osp/lutpreviewer
- Repository: https://github.com/jeasoon-osp/lutpreviewer

## Overview

##### Main Components
- Frontend/UI Layer:
- The Vue application forms the front end. Key files include index.html, src/App.vue, and src/components (for example, LutPage.vue).
- This component handles user interactions and data presentation.
- Asset and Public Resources:
- The public directory stores static files such as images, LUT files, and WebGL shader code (in public/shaders).
- These files are loaded by the frontend to support rendering and visual effects.
- Scripts / Domain-Specific Functionality:
- In the src/scripts folder, there are three main subdirectories:
- “gl”: Contains modules (GLCanvas.ts, GLUtils.ts) that likely manage WebGL context and rendering pipelines.
- “lut”: Holds LUT-related functionality (LutCanvas.ts, LutUtils.ts) for parsing/applying LUTs.
- “web”: Offers web utilities (ImageUtils.ts, TextUtils.ts) to process images or text, possibly for configuration or input validation.
- Supporting Libraries:
- The src/libs directory contains utility files such as LutUtils.js, which may provide high-level LUT processing or integration logic.
- Entry & Configuration:
- The main entry point src/main.ts bootstraps the Vue app.
- Configuration files like package.json, vite.config.js, and jsconfig.json define dependencies and build settings.

##### Relationships and Interactions
- The User starts in the Browser by accessing index.html, which loads the Vue app.
- The Vue components (e.g., LutPage.vue) interact with the modules in src/scripts:
- “gl” modules initialize and manage WebGL canvases.
- “lut” modules handle LUT-specific operations and shader management.
- “web” modules supply supportive utility functions (processing images or text data).
- Assets (like shader files and LUT images) from the public directory integrate with the runtime modules (gl and lut) to provide real-time rendering.
- The libraries (e.g., LutUtils.js) encapsulate core logic that might be used across multiple components for common LUT processing tasks.

##### Architectural Patterns and Principles
- Modular Separation: Clearly identify the separation between UI (Vue components) and domain logic (scripts for WebGL and LUT operations).
- Layered Architecture: Illustrate how the data flows from the client (browser) to the rendering engine and back. For instance, the UI layer consults the LUT processing layer, which in turn interacts with the WebGL layer.
- Reusability and Extensibility: Note that components like LutUtils and the specialized script modules provide reusable functionality essential for future scalability or enhancements.

##### Relevant Technologies
- Vue 3 with Vite: The core framework and bundler for the application.
- WebGL: Used via the GL modules to render shaders.
- JavaScript/TypeScript: Main language(s) used in the project (evidenced by .ts and .js files).
- Shaders: GLSL files (lut.frag, lut.vert) are crucial for the visual processing pipeline when applying LUT effects.

##### Instructing the Principal Software Engineer
- Branch out from the UI layer to the domain logic layer where:
- “gl” modules manage the WebGL canvas and rendering utilities.
- “lut” modules implement LUT-specific functionality, interfacing with shaders.
- “web” utilities perform operations on images/text required by the UI or processing modules.
- Lastly, add a layer showing the public assets (images, LUT data, shaders) feeding into the processing modules.
- How the entry point (src/main.ts) integrates all these components and how configuration files (vite.config.js, package.json) support the system’s build and deployment lifecycle.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Global Entities
    Browser("Browser/Client"):::browser

    %% Frontend/UI Layer
    Index("index.html"):::frontend
    Main("src/main.ts"):::config
    App("src/App.vue"):::frontend
    LutPage("src/components/LutPage.vue"):::frontend

    %% Domain Logic Layer
    subgraph "Domain Logic Layer"
        %% GL Modules
        subgraph "GL Modules"
            GLCanvas("src/scripts/gl/GLCanvas.ts"):::domain
            GLUtils("src/scripts/gl/GLUtils.ts"):::domain
        end
        %% LUT Modules
        subgraph "LUT Modules"
            LutCanvas("src/scripts/lut/LutCanvas.ts"):::domain
            LutUtils("src/scripts/lut/LutUtils.ts"):::domain
        end
        %% Web Utilities
        subgraph "Web Utilities"
            ImageUtils("src/scripts/web/ImageUtils.ts"):::domain
            TextUtils("src/scripts/web/TextUtils.ts"):::domain
        end
        Lib("src/libs/LutUtils.js"):::domain
    end

    %% Assets/Public Resources
    subgraph "Assets/Public Resources"
        Images("public/images"):::assets
        Luts("public/luts"):::assets
        Shaders("public/shaders"):::assets
        ShFrag("public/shaders/lut.frag"):::assets
        ShVert("public/shaders/lut.vert"):::assets
    end

    %% Configuration and Entry Files
    subgraph "Configuration/Entry Files"
        Package("package.json"):::config
        Vite("vite.config.js"):::config
        JSConfig("jsconfig.json"):::config
    end

    %% Connections
    Browser -->|"loads"| Index
    Index -->|"bootstraps"| Main
    Main -->|"renders"| App
    App -->|"contains"| LutPage

    LutPage -->|"calls"| GLCanvas
    LutPage -->|"calls"| GLUtils
    LutPage -->|"calls"| LutCanvas
    LutPage -->|"calls"| LutUtils
    LutPage -->|"calls"| ImageUtils
    LutPage -->|"calls"| TextUtils
    LutPage -->|"utilizes"| Lib

    GLCanvas -->|"rendersWith"| Shaders
    GLUtils -->|"utilizes"| Shaders

    LutCanvas -->|"appliesLUTFrom"| Luts
    LutUtils -->|"appliesLUTFrom"| Luts

    ImageUtils -->|"processes"| Images
    TextUtils -->|"processes"| Images

    Shaders -->|"includes"| ShFrag
    Shaders -->|"includes"| ShVert

    Package -->|"configures"| Main
    Vite -->|"configures"| Main
    JSConfig -->|"supports"| Main

    %% Click Events
    click Index "https://github.com/jeasoon-osp/lutpreviewer/blob/master/index.html"
    click Main "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/main.ts"
    click App "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/App.vue"
    click LutPage "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/components/LutPage.vue"
    click GLCanvas "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/scripts/gl/GLCanvas.ts"
    click GLUtils "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/scripts/gl/GLUtils.ts"
    click LutCanvas "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/scripts/lut/LutCanvas.ts"
    click LutUtils "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/scripts/lut/LutUtils.ts"
    click ImageUtils "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/scripts/web/ImageUtils.ts"
    click TextUtils "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/scripts/web/TextUtils.ts"
    click Lib "https://github.com/jeasoon-osp/lutpreviewer/blob/master/src/libs/LutUtils.js"
    click Images "https://github.com/jeasoon-osp/lutpreviewer/tree/master/public/images"
    click Luts "https://github.com/jeasoon-osp/lutpreviewer/tree/master/public/luts"
    click Shaders "https://github.com/jeasoon-osp/lutpreviewer/tree/master/public/shaders"
    click ShFrag "https://github.com/jeasoon-osp/lutpreviewer/blob/master/public/shaders/lut.frag"
    click ShVert "https://github.com/jeasoon-osp/lutpreviewer/blob/master/public/shaders/lut.vert"
    click Package "https://github.com/jeasoon-osp/lutpreviewer/blob/master/package.json"
    click Vite "https://github.com/jeasoon-osp/lutpreviewer/blob/master/vite.config.js"
    click JSConfig "https://github.com/jeasoon-osp/lutpreviewer/blob/master/jsconfig.json"

    %% Styles
    classDef browser fill:#AD7FA8,stroke:#000,stroke-width:2px
    classDef frontend fill:#FCE94F,stroke:#000,stroke-width:2px
    classDef domain fill:#8AE234,stroke:#000,stroke-width:2px
    classDef assets fill:#729FCF,stroke:#000,stroke-width:2px
    classDef config fill:#E9B96E,stroke:#000,stroke-width:2px

    class Browser browser
    class Index,App,LutPage frontend
    class Main,Package,Vite,JSConfig config
    class GLCanvas,GLUtils,LutCanvas,LutUtils,ImageUtils,TextUtils,Lib domain
    class Images,Luts,Shaders,ShFrag,ShVert assets
```
