# tsalb/lwc-utils architecture

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

- Interactive diagram: https://gitdiagram.com/tsalb/lwc-utils
- Repository: https://github.com/tsalb/lwc-utils

## Overview

##### Main Components Structure

a. UI Layer (Frontend)
- LWC Components
- Aura Components
- Message Service Bridge
- Dialog/Modal System

b. Service Layer
- Table Service
- Message Service
- Dialog Service
- Workspace Service

c. Backend Layer
- Apex Classes
- Custom Metadata Types
- Custom Objects

##### Component Details

a. Core Components:
- baseDatatable and variants
- messageService
- dialogService
- workspaceService

b. Utility Components:
- baseUtils
- tableService
- empApi
- singleton

c. Configuration Objects:
- Datatable_Config__mdt
- Datatable_Column_Config__mdt
- Datatable_Action_Config__mdt
- Datatable_Lookup_Config__mdt

##### Communication Flow

Message service pattern with:
- LMS (Lightning Message Service) channels
- Event publishing/subscription paths
- Modal/Dialog interaction flows

##### Implementation Details

Annotations for:
- Component extension points
- Configuration-driven features
- Integration points with Salesforce platform

**[UI Layer]**

- LWC Components
- Base Components (datatable, lookup, etc.)
- Utility Components

- Aura Components
- Dialog Service
- Flow Wrapper

**[Service Layer]**

- Message Service
- Table Service
- Workspace Service

**[Configuration Layer]**

- Custom Metadata Types
- Custom Objects

Key Guidelines:
##### Integration with Salesforce platform features

- Component hierarchy and relationships
- Message flow patterns
- Configuration points
- Extension mechanisms
- Integration touchpoints

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef lwc fill:#3498db,stroke:#2980b9,color:white
    classDef aura fill:#e67e22,stroke:#d35400,color:white
    classDef service fill:#f1c40f,stroke:#f39c12,color:black
    classDef apex fill:#2ecc71,stroke:#27ae60,color:white
    classDef config fill:#9b59b6,stroke:#8e44ad,color:white
    classDef communication fill:#e74c3c,stroke:#c0392b,color:white

    %% UI Layer
    subgraph UI
        %% LWC Components
        BD["Base Datatable"]:::lwc
        BL["Base Lookup"]:::lwc
        BP["Base Picklist"]:::lwc
        
        %% Aura Components
        DS["Dialog Service"]:::aura
        FW["Flow Wrapper"]:::aura
        MSH["Message Service Handler"]:::aura
        WS["Workspace Service"]:::aura
    end

    %% Service Layer
    subgraph Services
        TS["Table Service"]:::service
        MS["Message Service"]:::service
        DLS["Dialog Service"]:::service
        WSS["Workspace Service"]:::service
    end

    %% Backend Layer
    subgraph Backend
        DTS["DataTable Service"]:::apex
        LS["Lookup Service"]:::apex
    end

    %% Configuration Layer
    subgraph Config
        DC["Datatable Config"]:::config
        DCC["Datatable Column Config"]:::config
        DAC["Datatable Action Config"]:::config
        DLC["Datatable Lookup Config"]:::config
    end

    %% Communication Components
    MC["Message Channel"]:::communication
    EA["EMP API"]:::communication

    %% Utility Components
    BU["Base Utils"]:::lwc
    SG["Singleton"]:::lwc

    %% Relationships
    BD --> TS
    BD --> MS
    BL --> LS
    BP --> MS

    DS --> DLS
    MSH --> MS
    WS --> WSS

    TS --> DTS
    MS --> MC
    MS --> EA

    DTS --> DC
    DTS --> DCC
    DTS --> DAC
    LS --> DLC

    %% Click Events
    click BD "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/lwc/baseDatatable"
    click BL "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/lwc/baseLookup"
    click BP "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/lwc/basePicklist"
    click DS "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/aura/DialogService"
    click FW "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/aura/FlowWrapper"
    click MSH "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/aura/MessageServiceHandler"
    click WS "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/aura/WorkspaceService"
    click TS "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/lwc/tableService"
    click MS "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/lwc/messageService"
    click DTS "https://github.com/tsalb/lwc-utils/blob/master/utils-core/main/default/classes/DataTableService.cls"
    click LS "https://github.com/tsalb/lwc-utils/blob/master/utils-core/main/default/classes/LookupAuraService.cls"
    click DC "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/objects/Datatable_Config__mdt"
    click DCC "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/objects/Datatable_Column_Config__mdt"
    click DAC "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/objects/Datatable_Action_Config__mdt"
    click DLC "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/objects/Datatable_Lookup_Config__mdt"
    click MC "https://github.com/tsalb/lwc-utils/blob/master/utils-core/main/default/messageChannels/OpenChannel.messageChannel-meta.xml"
    click EA "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/lwc/empApi"
    click BU "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/lwc/baseUtils"
    click SG "https://github.com/tsalb/lwc-utils/tree/master/utils-core/main/default/lwc/singleton"
```
