# miroapp/quill architecture

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

- Interactive diagram: https://gitdiagram.com/miroapp/quill
- Repository: https://github.com/miroapp/quill

## Overview

##### Main Components Structure

a) Core Layer:
- Core components from src/core/:
- Quill (central component)
- Editor
- Selection
- Emitter (event system)
- Composition
- Theme

b) Blots Layer:
- This directly connected to the core
- Inheritance hierarchy:
- ScrollBlot (root)
- BlockBlot
- InlineBlot
- EmbedBlot
- TextBlot
- ContainerBlot

c) Modules Layer:
- As a separate section connecting to the core
- Modules:
- Clipboard
- History
- Keyboard
- Toolbar
- Syntax
- Table
- Uploader

d) Formats Layer:
- Format handlers:
- Text formats (bold, italic, underline)
- Block formats (header, list, blockquote)
- Embeds (image, video, formula)

e) Themes Layer:
- Theme hierarchy:
- Base Theme
- Snow Theme
- Bubble Theme

##### Interaction Flows

Key interactions:
- Event propagation through Emitter
- Content updates flow:
- User Input → Editor → Delta → DOM
- Module interaction with core
- Format application process
- Theme rendering pipeline

##### Important Details

- Delta format representation
- DOM interaction layer
- External HTML normalization flow
- Clipboard handling process
- Selection and cursor management
- Event system architecture

##### Additional Elements

Include:
- Version information
- Key API entry points
- External dependencies
- Build/bundle configuration

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#4d88ff
    classDef blot fill:#ffcccc,stroke:#ff8080
    classDef module fill:#c2f0c2,stroke:#5cd65c
    classDef format fill:#ffd9b3,stroke:#ffaa80
    classDef theme fill:#e6ccff,stroke:#bf80ff

    %% Core Layer
    subgraph CoreLayer["Core Components"]
        Quill["Quill Core"]
        Editor["Editor"]
        Selection["Selection"]
        Emitter["Emitter"]
        Composition["Composition"]
        ThemeBase["Theme Base"]
    end

    %% Blots Layer
    subgraph BlotsLayer["Blots Hierarchy"]
        ScrollBlot["ScrollBlot"]
        BlockBlot["BlockBlot"]
        InlineBlot["InlineBlot"]
        EmbedBlot["EmbedBlot"]
        TextBlot["TextBlot"]
        ContainerBlot["ContainerBlot"]
    end

    %% Modules Layer
    subgraph ModulesLayer["Modules"]
        Clipboard["Clipboard"]
        History["History"]
        Keyboard["Keyboard"]
        Toolbar["Toolbar"]
        Syntax["Syntax"]
        Table["Table"]
        Uploader["Uploader"]
    end

    %% Formats Layer
    subgraph FormatsLayer["Formats"]
        subgraph TextFormats["Text Formats"]
            Bold["Bold"]
            Italic["Italic"]
            Underline["Underline"]
        end
        subgraph BlockFormats["Block Formats"]
            Header["Header"]
            List["List"]
            Blockquote["Blockquote"]
        end
        subgraph EmbedFormats["Embed Formats"]
            Image["Image"]
            Video["Video"]
            Formula["Formula"]
        end
    end

    %% Themes Layer
    subgraph ThemesLayer["Themes"]
        Snow["Snow Theme"]
        Bubble["Bubble Theme"]
    end

    %% Relationships
    Quill --> Editor
    Quill --> Selection
    Quill --> Emitter
    Quill --> Composition
    Quill --> ThemeBase

    ScrollBlot --> BlockBlot
    ScrollBlot --> InlineBlot
    ScrollBlot --> EmbedBlot
    ScrollBlot --> TextBlot
    ScrollBlot --> ContainerBlot

    Editor --> ScrollBlot
    
    ThemeBase --> Snow
    ThemeBase --> Bubble

    %% Component Classes
    class Quill,Editor,Selection,Emitter,Composition,ThemeBase core
    class ScrollBlot,BlockBlot,InlineBlot,EmbedBlot,TextBlot,ContainerBlot blot
    class Clipboard,History,Keyboard,Toolbar,Syntax,Table,Uploader module
    class Bold,Italic,Underline,Header,List,Blockquote,Image,Video,Formula format
    class Snow,Bubble theme

    %% Click Events
    click Quill "https://github.com/miroapp/quill/blob/main/packages/quill/src/core/quill.ts"
    click Editor "https://github.com/miroapp/quill/blob/main/packages/quill/src/core/editor.ts"
    click Selection "https://github.com/miroapp/quill/blob/main/packages/quill/src/core/selection.ts"
    click Emitter "https://github.com/miroapp/quill/blob/main/packages/quill/src/core/emitter.ts"
    click Composition "https://github.com/miroapp/quill/blob/main/packages/quill/src/core/composition.ts"
    click ThemeBase "https://github.com/miroapp/quill/blob/main/packages/quill/src/core/theme.ts"
    click ScrollBlot "https://github.com/miroapp/quill/blob/main/packages/quill/src/blots/scroll.ts"
    click BlockBlot "https://github.com/miroapp/quill/blob/main/packages/quill/src/blots/block.ts"
    click InlineBlot "https://github.com/miroapp/quill/blob/main/packages/quill/src/blots/inline.ts"
    click EmbedBlot "https://github.com/miroapp/quill/blob/main/packages/quill/src/blots/embed.ts"
    click TextBlot "https://github.com/miroapp/quill/blob/main/packages/quill/src/blots/text.ts"
    click ContainerBlot "https://github.com/miroapp/quill/blob/main/packages/quill/src/blots/container.ts"
    click Clipboard "https://github.com/miroapp/quill/blob/main/packages/quill/src/modules/clipboard.ts"
    click History "https://github.com/miroapp/quill/blob/main/packages/quill/src/modules/history.ts"
    click Keyboard "https://github.com/miroapp/quill/blob/main/packages/quill/src/modules/keyboard.ts"
    click Toolbar "https://github.com/miroapp/quill/blob/main/packages/quill/src/modules/toolbar.ts"
    click Syntax "https://github.com/miroapp/quill/blob/main/packages/quill/src/modules/syntax.ts"
    click Table "https://github.com/miroapp/quill/blob/main/packages/quill/src/modules/table.ts"
    click Uploader "https://github.com/miroapp/quill/blob/main/packages/quill/src/modules/uploader.ts"
    click Bold "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/bold.ts"
    click Italic "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/italic.ts"
    click Underline "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/underline.ts"
    click Header "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/header.ts"
    click List "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/list.ts"
    click Blockquote "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/blockquote.ts"
    click Image "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/image.ts"
    click Video "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/video.ts"
    click Formula "https://github.com/miroapp/quill/blob/main/packages/quill/src/formats/formula.ts"
    click Snow "https://github.com/miroapp/quill/blob/main/packages/quill/src/themes/snow.ts"
    click Bubble "https://github.com/miroapp/quill/blob/main/packages/quill/src/themes/bubble.ts"
```
