# taqbostan/ngx-image-annotation architecture

> Architecture diagram of the GitHub repository taqbostan/ngx-image-annotation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/taqbostan/ngx-image-annotation
- Repository: https://github.com/taqbostan/ngx-image-annotation

## Overview

##### Project type and purpose
- This is an Angular component library (“ngx-image-annotation”) packaged with a small demo Angular application.

##### File structure
- Top-level
– angular.json, tsconfig.json, package.json: this is an Angular workspace configured to build both the library and the demo.
– demo/: a standalone Angular app that imports and demonstrates the annotation library.
– ngx-image-annotation/: the library source and build config:
· ng-package.json: ng-packagr config to package the library
· package.json: library metadata and dependencies
· src/: library sources
– annotator.service.ts / .spec.ts: encapsulates business logic and events
– public-api.ts: entry point exporting the component and service
– tsconfig.lib*.json, tsconfig.spec.json: compilation and test configs
- demo/:
– demo.component.ts/.html/.css: host component embedding the AnnotatorComponent
– dialog/: dialog.component.ts/.html/.css: UI overlay used by demo to show category selection
– demo.ts: main bootstrap or storybook-style entry for manual testing
– index.html: shell page for the demo

##### README for additional insights
- The README describes in-out properties, events, and methods of AnnotatorComponent.
- Mentions a peer dependency on an external image-labeling package and Angular core/common.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser
    Browser["Browser"]:::ext

    %% Demo Application
    subgraph "Demo Application"
        direction TB
        DemoApp["Demo Angular Application"]:::ui
        DemoComponent["DemoComponent"]:::ui
        DialogComponent["DialogComponent"]:::ui
        DemoEntry["demo.ts (Entry Point)"]:::config
        DemoShell["index.html"]:::config
    end

    %% Library
    subgraph "ngx-image-annotation Library"
        direction TB
        AnnotatorComponent["AnnotatorComponent"]:::ui
        AnnotatorService["AnnotatorService"]:::service
        PublicAPI["public-api.ts"]:::config
        NGPackage["ng-package.json"]:::config
        LibPackageJSON["package.json"]:::config
        TSConfigLib["tsconfig.lib.json"]:::config
        TSConfigProd["tsconfig.lib.prod.json"]:::config
        TSConfigSpec["tsconfig.spec.json"]:::config
    end

    %% External Dependencies
    subgraph "External Dependencies"
        direction TB
        AngularCore["@angular/core, @angular/common"]:::ext
        RxJS["RxJS"]:::ext
        ImageLabeling["image-labeling (peer)"]:::ext
    end

    %% Workspace Configuration
    subgraph "Workspace Config"
        direction TB
        AngularJson["angular.json"]:::config
        TSConfigRoot["tsconfig.json"]:::config
        RootPkg["package.json"]:::config
        RootLock["package-lock.json"]:::config
    end

    %% Relationships
    Browser --> DemoApp
    DemoApp --> DemoComponent
    DemoApp --> DialogComponent
    DemoApp --> DemoEntry
    DemoApp --> DemoShell

    DemoComponent -->|"loads"| AnnotatorComponent
    AnnotatorComponent -->|"injects"| AnnotatorService
    AnnotatorComponent -->|"onAdded, onEdited, onSelected, onContextMenu, onReady"| DemoComponent
    DemoComponent -->|"@ViewChild calls: drawCircle(), zoom(), getShapes(), updateCategories()"| AnnotatorComponent

    AnnotatorService -->|"manages shapes state"| AnnotatorComponent

    DemoComponent --> AngularCore
    AnnotatorComponent --> AngularCore
    AnnotatorService --> RxJS
    AnnotatorComponent --> ImageLabeling

    AngularJson --> NGPackage
    AngularJson --> DemoApp
    AngularJson --> AnnotatorComponent
    TSConfigRoot --> AnnotatorComponent
    TSConfigRoot --> DemoApp
    RootPkg --> DemoApp
    RootPkg --> AnnotatorComponent
    RootLock --> DemoApp
    RootLock --> AnnotatorComponent

    NGPackage --> PublicAPI
    NGPackage --> LibPackageJSON
    NGPackage --> TSConfigLib
    NGPackage --> TSConfigProd
    NGPackage --> TSConfigSpec

    %% Click Events
    click DemoApp "https://github.com/taqbostan/ngx-image-annotation/tree/main/demo/"
    click DemoComponent "https://github.com/taqbostan/ngx-image-annotation/blob/main/demo/demo.component.ts"
    click DialogComponent "https://github.com/taqbostan/ngx-image-annotation/blob/main/demo/dialog/dialog.component.ts"
    click DemoEntry "https://github.com/taqbostan/ngx-image-annotation/blob/main/demo/demo.ts"
    click DemoShell "https://github.com/taqbostan/ngx-image-annotation/blob/main/demo/index.html"
    click AnnotatorComponent "https://github.com/taqbostan/ngx-image-annotation/blob/main/ngx-image-annotation/src/annotator.component.ts"
    click AnnotatorService "https://github.com/taqbostan/ngx-image-annotation/blob/main/ngx-image-annotation/src/annotator.service.ts"
    click PublicAPI "https://github.com/taqbostan/ngx-image-annotation/blob/main/ngx-image-annotation/src/public-api.ts"
    click NGPackage "https://github.com/taqbostan/ngx-image-annotation/blob/main/ngx-image-annotation/ng-package.json"
    click LibPackageJSON "https://github.com/taqbostan/ngx-image-annotation/blob/main/ngx-image-annotation/package.json"
    click TSConfigLib "https://github.com/taqbostan/ngx-image-annotation/blob/main/ngx-image-annotation/tsconfig.lib.json"
    click TSConfigProd "https://github.com/taqbostan/ngx-image-annotation/blob/main/ngx-image-annotation/tsconfig.lib.prod.json"
    click TSConfigSpec "https://github.com/taqbostan/ngx-image-annotation/blob/main/ngx-image-annotation/tsconfig.spec.json"
    click AngularJson "https://github.com/taqbostan/ngx-image-annotation/blob/main/angular.json"
    click TSConfigRoot "https://github.com/taqbostan/ngx-image-annotation/blob/main/tsconfig.json"
    click RootPkg "https://github.com/taqbostan/ngx-image-annotation/blob/main/package.json"
    click RootLock "https://github.com/taqbostan/ngx-image-annotation/blob/main/package-lock.json"

    %% Styles
    classDef ui fill:#8fbc8f,stroke:#333,stroke-width:1px;
    classDef service fill:#add8e6,stroke:#333,stroke-width:1px;
    classDef ext fill:#d3d3d3,stroke:#333,stroke-width:1px;
    classDef config fill:#f0e68c,stroke:#333,stroke-width:1px;
```
