# thomas-lowry/figma-plugin-ds architecture

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

- Interactive diagram: https://gitdiagram.com/thomas-lowry/figma-plugin-ds
- Repository: https://github.com/thomas-lowry/figma-plugin-ds

## Overview

##### Project Type and Purpose
This is a UI component library specifically designed for creating Figma plugins. It's a lightweight, framework-agnostic library that provides CSS and JavaScript components matching Figma's native UI elements.

##### Main Components

Core Structure:

- Figma Plugin DS Library                                   |

- Styles (CSS)  |      |  Components   |        |  JavaScript  |

- Base Styles    |   | UI Components     |    | Interactive     |
- Variables    |   | - Buttons         |    | Components      |
- Utilities    |   | - Inputs         |    | - Select Menu   |
- Typography      |    +------------------+

##### Key Elements to Highlight

Distribution Formats:

- Distribution     |

- IIFE  |           |  Modules  |

Component Architecture:

- UI Component       |

- HTML  |     |   CSS     |

**Template      BEM Naming**
**Structure    Convention**

##### Important Relationships
- How styles and JavaScript modules can be imported independently
- Relationship between components and their JavaScript controllers
- Demonstrate the build process flow from source to distribution

##### Implementation Details
- Version/build information

Remember to include:
- Build/distribution paths
- Component dependencies
- Integration methods
- Clear separation between static and interactive components
- Relationship to Figma's plugin architecture

This system design should help developers understand both the library's architecture and how to effectively implement it in their Figma plugins.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph FigmaPluginDS["Figma Plugin DS Library"]
        direction TB
        
        subgraph Styles["Styles Layer"]
            direction TB
            BaseStyles["Base Styles"]:::styles
            Variables["Variables & Utilities"]:::styles
            click BaseStyles "https://github.com/thomas-lowry/figma-plugin-ds/tree/master/src/styles/"
            click Variables "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/src/styles/base/_figma-plugin-css-vars-utilities.scss"
        end

        subgraph UIComponents["UI Components Layer"]
            direction TB
            Buttons["Buttons"]:::component
            Inputs["Inputs"]:::component
            Icons["Icons"]:::component
            Typography["Typography"]:::component
            click Buttons "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/src/styles/components/_button.scss"
            click Inputs "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/src/styles/components/_input.scss"
            click Icons "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/src/styles/components/_icon.scss"
            click Typography "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/src/styles/components/_type.scss"
        end

        subgraph Interactive["Interactive Components"]
            direction TB
            SelectMenu["Select Menu"]:::interactive
            Disclosure["Disclosure"]:::interactive
            click SelectMenu "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/src/js/modules/selectMenu.js"
            click Disclosure "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/src/js/modules/disclosure.js"
        end

        subgraph Distribution["Distribution Layer"]
            direction TB
            IIFE["IIFE Bundle"]:::dist
            Modules["ES Modules"]:::dist
            CSS["CSS Bundle"]:::dist
            click IIFE "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/dist/iife/figma-plugin-ds.js"
            click Modules "https://github.com/thomas-lowry/figma-plugin-ds/tree/master/dist/modules/"
            click CSS "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/dist/figma-plugin-ds.css"
        end

        BuildSystem["Build System"]:::build
        MainEntry["Main Entry Points"]:::entry
        click BuildSystem "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/gulpfile.js"
        click MainEntry "https://github.com/thomas-lowry/figma-plugin-ds/blob/master/index.js"
    end

    %% Relationships
    BaseStyles --> UIComponents
    Variables --> UIComponents
    UIComponents --> Interactive
    Interactive --> Distribution
    MainEntry --> Distribution
    BuildSystem --> Distribution

    %% Styles
    classDef styles fill:#4CAF50,stroke:#2E7D32,color:white
    classDef component fill:#2196F3,stroke:#1976D2,color:white
    classDef interactive fill:#FF9800,stroke:#F57C00,color:white
    classDef dist fill:#9E9E9E,stroke:#616161,color:white
    classDef build fill:#607D8B,stroke:#455A64,color:white
    classDef entry fill:#673AB7,stroke:#512DA8,color:white

    %% Legend
    subgraph Legend
        direction TB
        Style["Styles"]:::styles
        Comp["UI Components"]:::component
        Int["Interactive Components"]:::interactive
        Dist["Distribution"]:::dist
        Build["Build System"]:::build
        Entry["Entry Points"]:::entry
    end
```
