# miquelabella/sereni-ui architecture

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

- Interactive diagram: https://gitdiagram.com/miquelabella/sereni-ui
- Repository: https://github.com/miquelabella/sereni-ui

## Overview

##### Main Components

- Web Component Source Code:
– The core of the project is the components found under the src/components directory.
– Each component (e.g., my-component, sereni-button, sereni-tooltip) resides in its subdirectory and consists of multiple files (TypeScript/TSX, CSS/SCSS, tests, and even a component-specific README).

- Stencil Compilation Pipeline:
– The Stencil compiler (configured via stencil.config.ts and tsconfig.json) transforms your TypeScript, JSX, and styles into standard Web Components.
– This pipeline handles lazy-loading and custom elements generation.

- Entry Point & Utilities:
– src/index.ts and src/index.html serve as the application or demo entry points.
– Additional utilities in src/utils provide shared functions used by the components or examples.

- Testing and Documentation Layers:
– Test files (.spec.ts, .e2e.ts) provided within each component ensure functionality.
– The README files (both project-wide and within some components) and configuration files (.editorconfig, .prettierrc.json, package.json) document usage and coding standards.

##### Relationships and Interactions

- Developers write and maintain the source code (i.e., component logic, styling, and tests) under src/components and src/utils.
- The Stencil compiler processes this source code through its build pipeline (configured via stencil.config.ts) converting TypeScript/JSX into browser-compatible Web Components.
- The output (which might be a standalone custom elements distribution) can then be consumed by various applications (e.g., through lazy-loading or direct import as described in the README).
- Testing frameworks (unit and e2e tests) interact directly with the components to verify behavior during development.

##### Architectural Patterns and Design Principles

- Component-Based Architecture:
– Each UI or functional piece is encapsulated as a reusable Web Component with its styles, behavior, and tests.

- Build-Time Transformation:
– Utilizing a compile-time pipeline (Stencil) to optimize runtime performance and produce standards-based Web Components.

- Separation of Concerns:
– Testing files are co-located with component code enabling focused development and maintainability.

##### Inclusion of Relevant Technologies, Frameworks, and Tools

- Stencil: The primary framework driving the compile-time process for creating Web Components.
- TypeScript/JSX: The language and syntax used to author the components.
- SCSS/CSS: Styling technologies used for components’ presentation.
- Testing tools: Likely Jest or similar testing libraries that work with Stencil (as seen by the .spec.ts and .e2e.ts files).
- Configuration and Build Tools: Managed via package.json, tsconfig.json, and stencil.config.ts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Code Layer
    subgraph "Source Code Layer"
        subgraph "Components"
            M1["my-component"]:::source
            V1["sereni-button"]:::source
            T1["sereni-tooltip"]:::source
        end
        U["Utilities"]:::source
        subgraph "Entry Points"
            I1["src/index.html"]:::entry
            I2["src/index.ts"]:::entry
        end
    end

    %% Build & Compilation Layer
    subgraph "Build & Compilation"
        SC["Stencil Compiler"]:::build
        C1["stencil.config.ts"]:::config
        C2["tsconfig.json"]:::config
    end

    %% Testing Layer
    subgraph "Testing Layer"
        TUNIT["Unit Tests"]:::testing
        TE2E["E2E Tests"]:::testing
        MTU["my-component.spec.ts"]:::testing
        MTE["my-component.e2e.ts"]:::testing
        UTEST["utils.spec.ts"]:::testing
    end

    %% Distribution Layer
    subgraph "Distribution/Integration"
        D["Compiled Web Components"]:::compiled
    end

    %% Connections from Source Code to Build Pipeline
    M1 -->|"source"| SC
    V1 -->|"source"| SC
    T1 -->|"source"| SC
    U  -->|"source"| SC
    I1 -->|"entry"| SC
    I2 -->|"entry"| SC

    %% Configuration Files feeding into Stencil Compiler
    C1 -->|"config"| SC
    C2 -->|"config"| SC

    %% Build output to Distribution
    SC -->|"build-output"| D

    %% Testing Connections
    M1 -->|"unit-test"| MTU
    M1 -->|"e2e-test"| MTE
    U  -->|"unit-test"| UTEST

    %% General Testing Group (for reference)
    MTU --- TUNIT
    MTE --- TE2E

    %% Click Events
    click M1 "https://github.com/miquelabella/sereni-ui/tree/main/src/components/my-component/"
    click V1 "https://github.com/miquelabella/sereni-ui/tree/main/src/components/sereni-button/"
    click T1 "https://github.com/miquelabella/sereni-ui/tree/main/src/components/sereni-tooltip/"
    click U "https://github.com/miquelabella/sereni-ui/tree/main/src/utils/"
    click I1 "https://github.com/miquelabella/sereni-ui/blob/main/src/index.html"
    click I2 "https://github.com/miquelabella/sereni-ui/blob/main/src/index.ts"
    click C1 "https://github.com/miquelabella/sereni-ui/blob/main/stencil.config.ts"
    click C2 "https://github.com/miquelabella/sereni-ui/blob/main/tsconfig.json"
    click MTU "https://github.com/miquelabella/sereni-ui/blob/main/src/components/my-component/my-component.spec.ts"
    click MTE "https://github.com/miquelabella/sereni-ui/blob/main/src/components/my-component/my-component.e2e.ts"
    click UTEST "https://github.com/miquelabella/sereni-ui/blob/main/src/utils/utils.spec.ts"

    %% Styles
    classDef source fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef build fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef config fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef entry fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef testing fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef compiled fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;
```
