# accionlabs/mermaid-powerpoint-addin architecture

> Architecture diagram of the GitHub repository accionlabs/mermaid-powerpoint-addin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/accionlabs/mermaid-powerpoint-addin
- Repository: https://github.com/accionlabs/mermaid-powerpoint-addin

## Overview

##### File Structure Highlights
- src/commands: Ribbon button definitions (commands.html & commands.ts)
- src/taskpane: React components (MermaidEditor, Settings), utility (powerPointUtils.ts), HTML/TSX entry points
- webpack.config.js & tsconfig.json: build configuration
- dist/: production build artifacts (HTML, JS bundles, manifest.xml)
- docs/: GitHub Pages preview of dist/
- manifest.xml / manifest-production.xml: Office Add-in manifest

##### Key Components
a. Client UI (Task Pane)
- MermaidEditor (React)
- Settings panel
- Build via Webpack → JS bundle served in the task pane iframe

b. Ribbon Commands
- commands.html loads command-specific scripts

c. Office.js API

- Runs in the task pane browser context
- Takes code → SVG/PNG → returns image data

e. Storage Layer
- Custom XML Parts inside PPTX file

f. Build & Deployment
- Webpack → dist
- GitHub Pages (docs/) for hosting static assets
- manifest-production.xml points to hosted URLs

##### Relationships and Data Flows
- User clicks a ribbon button → Office.js event triggers commands.ts → opens task pane
- Build process: Webpack bundles src into dist → dist deployed to GitHub Pages → manifest references these URLs

##### Architectural Patterns & Principles
- Modular separation: ribbon commands vs. task pane UI vs. storage utilities
- Single-page UI in an iframe (task pane)
- Client-only architecture—no server
- Build-time static hosting

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Ribbon Extension Layer
    subgraph "Ribbon Extension Layer"
        RC_HTML["commands.html"]:::frontend
        RC_TS["commands.ts"]:::frontend
    end

    %% Task Pane UI
    subgraph "Task Pane UI (Client UI)"
        TP_HTML["taskpane.html"]:::frontend
        TP_TSX["taskpane.tsx"]:::frontend
        subgraph "React Components"
            ME["MermaidEditor.tsx"]:::frontend
            ST["Settings.tsx"]:::frontend
        end
    end

    %% Office.js Integration & Storage Utilities
    subgraph "Office.js Integration & Storage"
        PU["powerPointUtils.ts"]:::integration
    end

    %% Mermaid.js Rendering Engine
    ME_Engine["Mermaid.js Rendering Engine"]:::integration

    %% PowerPoint File Storage
    PP_File["PowerPoint File<br>(Custom XML Parts + Shapes)"]:::storage

    %% Build & Deployment Pipeline
    subgraph "Build & Deployment"
        WP["webpack.config.js"]:::build
        TS["tsconfig.json"]:::build
        DIST["dist/"]:::build
        D_CMD["dist/commands.html"]:::build
        D_TP["dist/taskpane.html"]:::build
        D_MAN["dist/manifest.xml"]:::build
        DOCS["docs/"]:::build
        M_ROOT["manifest.xml"]:::build
        M_DOCS["docs/manifest.xml"]:::build
        DEP["deploy.js"]:::build
    end

    %% Interactions
    RC_TS -->|"Launch Task Pane"| TP_HTML
    TP_HTML --> TP_TSX
    TP_TSX --> ME
    TP_TSX --> ST
    ME --> ME_Engine
    ME_Engine -->|"SVG/PNG Preview"| ME
    ME -->|"Insert Diagram"| PU
    PU -->|"Office.js Insert"| PP_File
    RC_TS -->|"Edit Selected"| PU
    PU -->|"Read XML"| PP_File
    PP_File -->|"Return Code"| ME

    %% Build Flow
    TS --> WP
    WP --> DIST
    DIST --> D_CMD
    DIST --> D_TP
    DIST --> D_MAN
    DIST --> DOCS
    DOCS --> D_CMD
    DOCS --> D_TP
    DOCS --> M_DOCS
    M_ROOT --> D_MAN
    DEP --> DOCS

    %% Click Events
    click RC_HTML "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/src/commands/commands.html"
    click RC_TS "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/src/commands/commands.ts"
    click TP_HTML "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/src/taskpane/taskpane.html"
    click TP_TSX "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/src/taskpane/taskpane.tsx"
    click ME "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/src/taskpane/components/MermaidEditor.tsx"
    click ST "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/src/taskpane/components/Settings.tsx"
    click PU "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/src/taskpane/utils/powerPointUtils.ts"
    click WP "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/webpack.config.js"
    click TS "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/tsconfig.json"
    click DIST "https://github.com/accionlabs/mermaid-powerpoint-addin/tree/main/dist/"
    click D_CMD "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/dist/commands.html"
    click D_TP "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/dist/taskpane.html"
    click D_MAN "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/dist/manifest.xml"
    click DOCS "https://github.com/accionlabs/mermaid-powerpoint-addin/tree/main/docs/"
    click M_ROOT "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/manifest.xml"
    click M_DOCS "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/docs/manifest.xml"
    click DEP "https://github.com/accionlabs/mermaid-powerpoint-addin/blob/main/deploy.js"

    %% Styles
    classDef frontend fill:#bbf,stroke:#333,stroke-width:1px
    classDef integration fill:#bfb,stroke:#333,stroke-width:1px
    classDef storage fill:#fbb,stroke:#333,stroke-width:1px
    classDef build fill:#eee,stroke:#333,stroke-width:1px
```
