# hayrapetyanlusine/color-dropper architecture

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

- Interactive diagram: https://gitdiagram.com/hayrapetyanlusine/color-dropper
- Repository: https://github.com/hayrapetyanlusine/color-dropper

## Overview

##### Project type and purpose
- This is a single-page, component-based front-end application built with Angular (v17.1.1).

##### File structure
- Top level:
- angular.json, tsconfig*.json, package.json → Angular CLI configuration, build and type settings
- src/ → application source
- cypress/ → end-to-end testing
- src/app/
- app.component.* → root component (AppComponent)
- app.routes.ts → routing definitions
- app.config.ts → application-wide configuration constants
- interface/ → TypeScript interfaces (ColorData, File)
- services/data.service.ts → central data-management service
- shared/
– components/
· canvas/CanvasComponent → image renderer + click handler
· upload-file/UploadFileComponent → file-picker UI element
– directives/
· FileInputDirective → custom file-input binding
· TooltipDirective → hover tooltip behavior
– functions/
– constants.ts → shared constant values
- cypress/
- e2e tests (spec.cy.ts), support commands, fixtures

##### README
- Standard Angular CLI project
- No back-end or API integrations described → this is purely client-side

##### Elements
- External tools (Cypress/Karma)
- User → Components (input flows)
- Components → Services (injections/calls)
- Components → Utilities (drawImage, getColorAtPoint)
- Service → Components (observables or callbacks)
- UI layer (blue)
- Business/data layer (green)
- Utility layer (orange)
- Testing (gray)

##### Detailed capture of architecture
- Utility functions near the components that invoke them.
- HTML index.html and Angular bootstrap (main.ts → AppModule) as the entry point.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Entry Point
    subgraph "Entry Point"
        Index["index.html"]:::entry
        Main["main.ts"]:::entry
    end

    %% Angular Module & Config
    subgraph "App Module"
        AppRoutes["RoutingModule\n(app.routes.ts)"]:::config
        AppConfig["AppConfig\n(app.config.ts)"]:::config
        AppModule["AppModule"]:::config
        AppComponent["AppComponent\n(src/app/app.component.ts)"]:::ui
    end

    %% Interfaces
    subgraph "Interfaces"
        ColorData["ColorData Interface"]:::data
        FileIF["File Interface"]:::data
    end

    %% UI Components
    subgraph "UI Components"
        DropperLayout["DropperLayoutComponent"]:::ui
        Upload["UploadFileComponent"]:::ui
        Canvas["CanvasComponent"]:::ui
        Toolbar["ToolbarComponent"]:::ui
    end

    %% Directives
    subgraph "Directives"
        FileInput["FileInputDirective"]:::directive
        Tooltip["TooltipDirective"]:::directive
    end

    %% Service
    subgraph "Services"
        DataService["DataService"]:::service
    end

    %% Utilities
    subgraph "Utilities"
        DrawImage["drawImage()"]:::util
        GetColor["getColorAtPoint()"]:::util
    end

    %% Testing
    subgraph "Testing"
        Cypress["Cypress E2E Tests"]:::test
    end

    %% Relationships
    Index --> Main
    Main --> AppModule
    AppModule --> AppRoutes
    AppModule --> AppConfig
    AppModule --> AppComponent
    AppComponent --> DropperLayout
    DropperLayout --> Toolbar
    Toolbar -->|"uploadFile() event"| Upload
    Upload --> FileInput
    FileInput -->|passes File| DataService
    DataService -->|notifies| Canvas
    Canvas --> DrawImage
    Canvas --> GetColor
    GetColor --> ColorData
    DataService --> ColorData
    DataService --> FileIF
    Canvas -->|"pickColor()"| DataService
    DataService --> Toolbar
    Cypress --> AppComponent

    %% Click Events
    click AppComponent "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/app.component.ts"
    click AppRoutes "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/app.routes.ts"
    click AppConfig "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/app.config.ts"
    click ColorData "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/interface/colorData.ts"
    click FileIF "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/interface/file.ts"
    click DataService "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/services/data.service.ts"
    click Canvas "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/shared/components/canvas/canvas.component.ts"
    click Toolbar "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/shared/components/toolbar/toolbar.component.ts"
    click Upload "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/shared/components/upload-file/upload-file.component.ts"
    click DropperLayout "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/shared/components/dropper-layout.component.ts"
    click FileInput "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/shared/directives/file-input.directive.ts"
    click Tooltip "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/shared/directives/tooltip.directive.ts"
    click DrawImage "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/shared/functions/drawImage.ts"
    click GetColor "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/app/shared/functions/getColorAtPoint.ts"
    click Main "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/main.ts"
    click Index "https://github.com/hayrapetyanlusine/color-dropper/blob/master/src/index.html"
    click Cypress "https://github.com/hayrapetyanlusine/color-dropper/blob/master/cypress/e2e/spec.cy.ts"

    %% Styles
    classDef ui fill:#a2d2ff,stroke:#0366d6,stroke-width:1px
    classDef service fill:#c6f6d5,stroke:#2f855a,stroke-width:1px
    classDef util fill:#ffe8a1,stroke:#dd6b20,stroke-width:1px
    classDef directive fill:#f0e68c,stroke:#b7791f,stroke-width:1px
    classDef config fill:#E0BBE4,stroke:#9B5DE5,stroke-width:1px
    classDef data fill:#EDE7F6,stroke:#6A1B9A,stroke-width:1px
    classDef entry fill:#d6bcfa,stroke:#805ad5,stroke-width:1px
    classDef test fill:#e2e8f0,stroke:#4a5568,stroke-width:1px
```
