# enactjs/enact architecture

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

- Interactive diagram: https://gitdiagram.com/enactjs/enact
- Repository: https://github.com/enactjs/enact

## Overview

##### Main Components

a. Core Framework Components:
- Core Package (@enact/core)
- UI Package (@enact/ui)
- Spotlight Package (@enact/spotlight)
- i18n Package (@enact/i18n)
- WebOS Package (@enact/webos)

b. Key Architectural Layers:
- Application Layer
- Component Layer
- Framework Services Layer
- Platform Integration Layer

**[Application Layer]**

- [Component Layer]
- UI Components
- Basic (Button, Image, Layout)
- Complex (VirtualList, ViewManager)
- Containers (FloatingLayer, Scroller)

- Component Features
- Skinnable
- Spottable
- I18nDecorator

- [Framework Services]
- Core Services
- Kind System
- HOC Support
- Event Handling

- Spotlight System
- Focus Management
- 5-way Navigation

- I18n System
- Language Support
- Resource Management

- Platform Services
- WebOS Integration
- Device Features

- [Platform Integration]
- React Core
- WebOS Platform
- Browser Platform

##### Additional Elements

- Component types
- Connection types
- Version information

b. Annotations:
- Key architectural patterns
- Important dependencies
- Extension points

##### Implementation Notes
- Maintain proper spacing and alignment
- Version numbers
- Brief descriptions for major components

- The layered architecture of Enact
- Component relationships and dependencies
- Service integration points
- Platform compatibility
- Extension mechanisms

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Application
        App[Application Layer]
    end

    subgraph ComponentLayer[Component Layer]
        UI[UI Components]
        CompFeatures[Component Features]

        subgraph UIComponents[UI Components]
            Basic["Basic Components"]:::ui
            Complex["Complex Components"]:::ui
            Containers["Containers"]:::ui
        end

        subgraph Features[Component Features]
            Skinnable["Skinnable"]:::feature
            Spottable["Spottable"]:::feature
            I18nDec["I18nDecorator"]:::feature
        end
    end

    subgraph FrameworkServices[Framework Services]
        CoreServices[Core Services]
        SpotlightSystem[Spotlight System]
        I18nSystem[I18n System]
        PlatformServices[Platform Services]

        subgraph Core[Core Services]
            Kind["Kind System"]:::core
            HOC["HOC Support"]:::core
            EventHandling["Event Handling"]:::core
        end

        subgraph Spotlight[Spotlight System]
            FocusManagement["Focus Management"]:::spotlight
            Navigation["5-way Navigation"]:::spotlight
        end

        subgraph I18n[I18n System]
            LangSupport["Language Support"]:::i18n
            ResourceMgmt["Resource Management"]:::i18n
        end

        subgraph Platform[Platform Services]
            WebOSInt["WebOS Integration"]:::platform
            DeviceFeatures["Device Features"]:::platform
        end
    end

    subgraph PlatformIntegration[Platform Integration]
        React["React Core"]:::external
        WebOS["WebOS Platform"]:::external
        Browser["Browser Platform"]:::external
    end

    %% Connections
    App --> ComponentLayer
    ComponentLayer --> FrameworkServices
    FrameworkServices --> PlatformIntegration

    %% Component Layer Connections
    UI --> Basic
    UI --> Complex
    UI --> Containers
    CompFeatures --> Skinnable
    CompFeatures --> Spottable
    CompFeatures --> I18nDec

    %% Service Layer Connections
    CoreServices --> Kind
    CoreServices --> HOC
    CoreServices --> EventHandling
    SpotlightSystem --> FocusManagement
    SpotlightSystem --> Navigation
    I18nSystem --> LangSupport
    I18nSystem --> ResourceMgmt
    PlatformServices --> WebOSInt
    PlatformServices --> DeviceFeatures

    %% Click Events
    click Kind "https://github.com/enactjs/enact/blob/master/packages/core/kind/kind.js"
    click HOC "https://github.com/enactjs/enact/blob/master/packages/core/hoc/hoc.js"
    click EventHandling "https://github.com/enactjs/enact/blob/master/packages/core/dispatcher/dispatcher.js"
    click FocusManagement "https://github.com/enactjs/enact/blob/master/packages/spotlight/src/spotlight.js"
    click Navigation "https://github.com/enactjs/enact/blob/master/packages/spotlight/src/navigate.js"
    click LangSupport "https://github.com/enactjs/enact/blob/master/packages/i18n/I18nDecorator/I18nDecorator.js"
    click ResourceMgmt "https://github.com/enactjs/enact/blob/master/packages/i18n/src/resBundle.js"
    click WebOSInt "https://github.com/enactjs/enact/blob/master/packages/webos/platform/platform.js"
    click Skinnable "https://github.com/enactjs/enact/blob/master/packages/ui/Skinnable/Skinnable.js"
    click Spottable "https://github.com/enactjs/enact/blob/master/packages/spotlight/Spottable/Spottable.js"
    click I18nDec "https://github.com/enactjs/enact/blob/master/packages/i18n/I18nDecorator/I18nDecorator.js"
    click Basic "https://github.com/enactjs/enact/blob/master/packages/ui/Button/Button.js"

    %% Directory Click Events
    click CoreServices "https://github.com/enactjs/enact/tree/master/packages/core/"
    click UI "https://github.com/enactjs/enact/tree/master/packages/ui/"
    click SpotlightSystem "https://github.com/enactjs/enact/tree/master/packages/spotlight/"
    click I18nSystem "https://github.com/enactjs/enact/tree/master/packages/i18n/"
    click PlatformServices "https://github.com/enactjs/enact/tree/master/packages/webos/"

    %% Styles
    classDef core fill:#2196F3,color:white
    classDef ui fill:#4CAF50,color:white
    classDef spotlight fill:#FF9800,color:white
    classDef i18n fill:#9C27B0,color:white
    classDef platform fill:#607D8B,color:white
    classDef feature fill:#00BCD4,color:white
    classDef external fill:#9E9E9E,color:white

    %% Legend
    subgraph Legend
        CoreLegend["Core Components"]:::core
        UILegend["UI Components"]:::ui
        SpotlightLegend["Spotlight Components"]:::spotlight
        I18nLegend["I18n Components"]:::i18n
        PlatformLegend["Platform Components"]:::platform
        FeatureLegend["Features"]:::feature
        ExternalLegend["External Dependencies"]:::external
    end
```
