# gaelj/blazorcodemirror6 architecture

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

- Interactive diagram: https://gitdiagram.com/gaelj/blazorcodemirror6
- Repository: https://github.com/gaelj/blazorcodemirror6

## Overview

- Client Application                                      |

- Blazor WASM App  |  | Blazor Server    |  | Interactive Server   |                  |
- (Example)        |  | (Example)        |  | (Example)            |                  |

- ↓

- BlazorCodeMirror6 Component                                |

- Blazor Component |  | .NET Interop     |  | JavaScript Module    |                  |
- Layer            |  | Layer            |  | Layer                |                  |

- ↓

- CodeMirror 6 Core (External)                               |

##### Component Details

For the BlazorCodeMirror6 Component section, create detailed sub-sections:

a) Blazor Component Layer:
- CodeMirror6Wrapper.razor (Main component)
- CodeMirror6WrapperInternal.razor (Implementation)
- Models/ (Configuration and state models)
- Commands/ (Command handling)
- Converters/ (Data conversion)

b) .NET Interop Layer:
- JsInterop methods
- JsInvokable methods
- Event handling
- State management

c) JavaScript Module Layer:
- NodeLib/src/ TypeScript implementations
- CodeMirror configuration
- Plugin system
- Theme handling

##### Special Features Section

- Features Support                                        |

- Markdown Support |  | Language Support |  | Editor Features      |                   |
- Syntax         |  | - 145 Languages  |  | - Auto-completion    |                   |
- Preview        |  | - Highlighting   |  | - Linting           |                   |
- Commands       |  | - C# Support     |  | - Themes            |                   |

##### Integration Points

Integration points with:
- File system (for uploads)
- Custom extensions

##### Important Notes

Callouts for:
- No HeadOutlet requirement
- Automatic resource loading
- Build process integration
- TypeScript/JavaScript bundling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Applications"]
        WASM["Blazor WASM App"]:::example
        Server["Blazor Server App"]:::example
        Interactive["Interactive Server App"]:::example
    end

    subgraph BCM["BlazorCodeMirror6 Component"]
        subgraph BLayer["Blazor Component Layer"]
            Wrapper["CodeMirror6Wrapper"]:::blazor
            WrapperInternal["CodeMirror6WrapperInternal"]:::blazor
            Models["Models"]:::blazor
            Commands["Commands"]:::blazor
            Converters["Converters"]:::blazor
        end

        subgraph ILayer["Interop Layer"]
            JsInterop["JS Interop Methods"]:::interop
            JsInvokable["JS Invokable Methods"]:::interop
        end

        subgraph JsLayer["JavaScript Module Layer"]
            TypeScript["TypeScript Source"]:::js
            Config["Configuration"]:::js
            Instance["Core Instance"]:::js
            Theme["Theme Handling"]:::js
            Language["Language Support"]:::js
            CompiledJs["Compiled JS Module"]:::js
        end
    end

    subgraph Features["Features Support"]
        Markdown["Markdown Support"]:::feature
        LangSupport["Language Support"]:::feature
        EditorFeatures["Editor Features"]:::feature
        subgraph EF["Editor Feature Details"]
            AutoComplete["Auto-completion"]:::feature
            Linting["Linting"]:::feature
            FileHandling["File Handling"]:::feature
        end
    end

    subgraph External["External Dependencies"]
        CM6["CodeMirror 6 Core"]:::external
    end

    Client --> BCM
    BLayer --> ILayer
    ILayer <--> JsLayer
    JsLayer --> CM6
    JsLayer --> Features

    %% Click events for component mapping
    click Wrapper "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/CodeMirror6Wrapper.razor"
    click WrapperInternal "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/CodeMirror6WrapperInternal.razor"
    click Models "https://github.com/gaelj/BlazorCodeMirror6/tree/main/CodeMirror6/Models/"
    click Commands "https://github.com/gaelj/BlazorCodeMirror6/tree/main/CodeMirror6/Commands/"
    click Converters "https://github.com/gaelj/BlazorCodeMirror6/tree/main/CodeMirror6/Converters/"
    click JsInterop "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/CodeMirror6WrapperInternal.razor.JsInterop.cs"
    click JsInvokable "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/CodeMirror6WrapperInternal.razor.JsInvokables.cs"
    click TypeScript "https://github.com/gaelj/BlazorCodeMirror6/tree/main/CodeMirror6/NodeLib/src/"
    click Config "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/NodeLib/src/CmConfiguration.ts"
    click Instance "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/NodeLib/src/CmInstance.ts"
    click Theme "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/NodeLib/src/CmTheme.ts"
    click Language "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/NodeLib/src/CmLanguage.ts"
    click CompiledJs "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/Resources/GaelJ.BlazorCodeMirror6.lib.module.js"
    click WASM "https://github.com/gaelj/BlazorCodeMirror6/tree/main/Examples.BlazorWasm/"
    click Server "https://github.com/gaelj/BlazorCodeMirror6/tree/main/Examples.BlazorServer/"
    click Interactive "https://github.com/gaelj/BlazorCodeMirror6/tree/main/Examples.BlazorServerInteractive/"
    click Markdown "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/NodeLib/src/CmHideMarkdownMarks.ts"
    click AutoComplete "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/NodeLib/src/CmEmojiCompletion.ts"
    click Linting "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/NodeLib/src/CmLint.ts"
    click FileHandling "https://github.com/gaelj/BlazorCodeMirror6/blob/main/CodeMirror6/NodeLib/src/CmFileUpload.ts"

    classDef blazor fill:#4a9eff,stroke:#666
    classDef interop fill:#ffa500,stroke:#666
    classDef js fill:#2ecc71,stroke:#666
    classDef external fill:#9b59b6,stroke:#666
    classDef example fill:#95a5a6,stroke:#666
    classDef feature fill:#e74c3c,stroke:#666
```
