# daybrush/moveable architecture

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

- Interactive diagram: https://gitdiagram.com/daybrush/moveable
- Repository: https://github.com/daybrush/moveable

## Overview

##### Main Components Structure

a) Core Layer
- Main event management system
- Base transformation calculations engine
- Gesture detection system

b) Framework Adapters Layer
- Connections to all supported frameworks:
- React
- Preact
- Angular
- Vue (2 & 3)
- Svelte
- Lit
- Vanilla JS

c) Features Layer
- Main features into logical sections:
- Transform Operations (Drag, Resize, Scale, Rotate)
- Advanced Transformations (Warp, Pinch)
- Grouping Features (Group, Individual)
- Helper Features (Snap, Guidelines)
- UI Features (Controls, Handles)

##### Component Relationships

**[Core Engine] → [Event System] → [Framework Adapters]**
- ↓
- [Feature Modules]
- ↓
- [DOM Manipulation Layer]

##### Detailed Components

Specific components:
**Core:**
- MoveableManager
- EventManager
- GestoManager
- TransformManager

**Features:**
- Draggable
- Resizable
- Scalable
- Rotatable
- Warpable
- Pinchable
- Groupable
- Snappable

##### Integration Points

Integration points for:
- External event systems
- DOM manipulation
- Framework-specific bindings
- Custom feature plugins

##### Technical Details

Annotations for:
- TypeScript interfaces
- Event system architecture
- Framework binding mechanisms
- DOM update strategy
- Performance optimization points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core
        CE["Core Engine"]:::core
        ES["Event System"]:::core
        GS["Gesture System"]:::core
        TM["Transform Manager"]:::core

        CE --> ES
        ES --> GS
        GS --> TM
    end

    subgraph "Framework Adapters"
        RA["React Adapter"]:::adapter
        PA["Preact Adapter"]:::adapter
        AA["Angular Adapter"]:::adapter
        VA["Vue Adapter"]:::adapter
        SA["Svelte Adapter"]:::adapter
        LA["Lit Adapter"]:::adapter
    end

    subgraph "Transform Operations"
        DR["Draggable"]:::feature
        RS["Resizable"]:::feature
        SC["Scalable"]:::feature
        RT["Rotatable"]:::feature
    end

    subgraph "Advanced Transformations"
        WP["Warpable"]:::feature
        PC["Pinchable"]:::feature
    end

    subgraph "Grouping Features"
        GM["Group Manager"]:::feature
        GP["Groupable"]:::feature
    end

    subgraph "Helper Features"
        SN["Snappable"]:::feature
        CP["Clippable"]:::feature
    end

    subgraph "Core Utils"
        PC1["Position Calculator"]:::util
        MC["Matrix Calculator"]:::util
        EI["Element Info"]:::util
    end

    subgraph "Store"
        ST["Store Implementation"]:::store
    end

    Core --> ST
    ST --> |State Updates| RA & PA & AA & VA & SA & LA
    ES --> DR & RS & SC & RT & WP & PC & GM & GP & SN & CP
    Core --> PC1 & MC & EI

    classDef core fill:#2374ab,stroke:#2374ab,color:#fff
    classDef adapter fill:#57a773,stroke:#57a773,color:#fff
    classDef feature fill:#ff8c42,stroke:#ff8c42,color:#fff
    classDef util fill:#9b5de5,stroke:#9b5de5,color:#fff
    classDef store fill:#f15bb5,stroke:#f15bb5,color:#fff

    click CE "https://github.com/daybrush/moveable/blob/master/packages/moveable/src/MoveableManager.tsx"
    click ES "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/EventManager.ts"
    click GS "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/gesto/CustomGesto.ts"
    click RA "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/Moveable.tsx"
    click PA "https://github.com/daybrush/moveable/blob/master/packages/preact-moveable/src/preact-moveable/Moveable.ts"
    click AA "https://github.com/daybrush/moveable/blob/master/packages/ngx-moveable/projects/ngx-moveable/src/ngx-moveable.component.ts"
    click VA "https://github.com/daybrush/moveable/blob/master/packages/vue-moveable/src/Moveable.vue"
    click SA "https://github.com/daybrush/moveable/blob/master/packages/svelte-moveable/src/lib/Moveable.svelte"
    click LA "https://github.com/daybrush/moveable/blob/master/packages/lit-moveable/src/LitMoveable.ts"
    click DR "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/ables/Draggable.tsx"
    click RS "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/ables/Resizable.ts"
    click SC "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/ables/Scalable.ts"
    click RT "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/ables/Rotatable.tsx"
    click WP "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/ables/Warpable.tsx"
    click PC "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/ables/Pinchable.ts"
    click GM "https://github.com/daybrush/moveable/blob/master/packages/helper/src/GroupManager.ts"
    click GP "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/ables/Groupable.tsx"
    click SN "https://github.com/daybrush/moveable/blob/master/packages/snappable/src/Snappable.ts"
    click CP "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/ables/Clippable.tsx"
    click PC1 "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/utils/calculateElementPosition.ts"
    click MC "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/utils/calculateMatrixStack.ts"
    click EI "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/utils/getElementInfo.ts"
    click ST "https://github.com/daybrush/moveable/blob/master/packages/react-moveable/src/store/Store.ts"
```
