# missive/emoji-mart architecture

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

- Interactive diagram: https://gitdiagram.com/missive/emoji-mart
- Repository: https://github.com/missive/emoji-mart

## Overview

##### Main Components
- Data Layer ("emoji-mart-data"): This package holds all the emoji datasets, internationalization files (i18n), and builds the assets needed for the picker. It is completely decoupled from the UI layer so that developers can either bundle the data directly or fetch it remotely.
- Core Library ("emoji-mart"): This package contains all the primary logic for rendering the emoji picker as a web component. It includes components like the base emoji, navigation, picker, and helper functions (for frequently used emojis, native support checking, search index, etc.).
- React Wrapper ("emoji-mart-react"): This package provides a React component interface for the emoji picker. It internally utilizes the core library so that React applications can easily integrate the picker.
- Demo/Website ("emoji-mart-website"): This package demonstrates how to use the emoji picker in a web context. It includes examples, assets, and HTML examples to showcase each feature and customization.
- Testing & Configuration: Look for test files in the "__tests__" directories (e.g., in "emoji-mart/src/__tests__") as well as jest configuration and TS config files, which reflect the project’s emphasis on unit tests and modern code standards.
- Build/Utility Files: Files such as package.json at various levels, build scripts (for data packaging and demo website), and configuration files (e.g., .editorconfig, .prettierignore) that help tie all components together.

##### Relationships and Interactions
- The Emoji Picker component (core library) depends on the Data Layer for the emoji datasets and i18n options.
- The React Wrapper encapsulates the core library into a React-friendly interface, so there is an interaction from React applications to the core picker logic.
- The Demo Website interacts with both the core library and the React wrapper (depending on the example) to demonstrate UI and customization options.
- Under the hood, helper functions (search and native data retrieval) interact with the Data Layer after initialization.
- Data flows from the external data source (either bundled within the app or fetched remotely) into the picker’s rendering logic.

##### Architectural Patterns and Design Principles
- Modularity: The separation into distinct packages (data, core, React, website) shows commitment to modularity and separation of concerns.
- Decoupled Data and Presentation: The emoji data is completely detached from the UI components allowing developers the flexibility to manage bundle size and data loading strategies.
- Component-based Architecture: Both custom web components and the React component encapsulate specific UI functionality.
- Modern Web Standards: Usage of Shadow DOM, Custom Elements, IntersectionObserver, and async/await—features that modern browsers support.

##### Relevant Technologies, Frameworks, and Libraries
- JavaScript / TypeScript is the language used in the codebase.
- React (via the emoji-mart-react package) for component-based UI integration.
- Testing with Jest (as indicated by jest.config.js and tests under __tests__ directories).
- Web Component standards (Custom Elements, Shadow DOM) are leveraged for rendering the emoji picker.
- Build tooling and configuration files (e.g., package.json and tsconfig.json) that set up the modular environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Integration Layer
    subgraph "UI Integration"
        R("React Wrapper (emoji-mart-react)"):::react
        D("Demo/Website (emoji-mart-website)"):::website
    end

    %% Core Library Layer
    subgraph "Core Library (emoji-mart)"
        P("Picker Component"):::core
        E("Emoji Component"):::core
        N("Navigation"):::core
        H("Helper Functions"):::core
    end

    %% Data Layer at the bottom
    DLayer("Data Layer (emoji-mart-data)"):::data

    %% Supporting Testing & Configuration
    T("Testing & Config"):::test

    %% Relationships and Data Flow
    DLayer -->|"providesData"| H
    DLayer -->|"providesData"| P
    H -->|"searchLookup"| P
    E -->|"emojiDisplay"| P
    N -->|"categoryNav"| P
    P -->|"rendersIn"| R
    P -->|"rendersIn"| D
    T -->|"tests_build"| P
    T -->|"tests_build"| DLayer

    %% Click Events
    click DLayer "https://github.com/missive/emoji-mart/tree/main/packages/emoji-mart-data"
    click P "https://github.com/missive/emoji-mart/tree/main/packages/emoji-mart/src"
    click R "https://github.com/missive/emoji-mart/tree/main/packages/emoji-mart-react"
    click D "https://github.com/missive/emoji-mart/tree/main/packages/emoji-mart-website"
    click T "https://github.com/missive/emoji-mart/tree/main/packages/emoji-mart/src/__tests__"

    %% Styles
    classDef data fill:#ffd966,stroke:#b58900,stroke-width:2px;
    classDef core fill:#cfe2f3,stroke:#2e6c80,stroke-width:2px;
    classDef react fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef website fill:#ead1dc,stroke:#a64d79,stroke-width:2px;
    classDef test fill:#f4cccc,stroke:#cc0000,stroke-width:2px;
```
