# ypyl/blazor-timeline-component architecture

> Architecture diagram of the GitHub repository ypyl/blazor-timeline-component, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ypyl/blazor-timeline-component
- Repository: https://github.com/ypyl/blazor-timeline-component

## Overview

##### Project Type and Purpose
- This is a UI component library (“component” folder) plus a demo client-side Blazor WebAssembly app (“example” folder).
- Purpose: build a reusable Timeline component in Blazor, demonstrate it in a standalone SPA using TailwindCSS and JS interop (Intersection Observer API).

##### File Structure & Architectural Insights
- Top-level:
- timeline.sln   – solution containing both projects
- component/    – Blazor component library (Timeline.razor + CSS + JS interop + .csproj)
- example/     – Blazor WebAssembly demo app referencing the component
- component/wwwroot/timelineComponentJsInterop.js and .cs file → JS interop layer using Intersection Observer.
- example/wwwroot/css/app.css → TailwindCSS styling for the demo.

##### Key Architectural Patterns
- Component-based UI (Blazor Razor components).
- Layered client-side architecture:
a. Presentation/UI layer (Razor components + CSS).
b. Component library (DLL) consumed by the app.
c. JS Interop layer bridging .NET/WASM and browser APIs.
- Single-Page Application (SPA) hosted as static files.

##### Main Components & Interactions
A. Developer / Build Environment
- MSBuild/`dotnet build` → produces two outputs:
– Component DLL + static assets (JS, CSS)
– Example app WebAssembly bundle + static assets
B. Static Web Server
- Serves `index.html`, `_framework/*.wasm`, CSS, JS
C. Browser (Client)
- .NET WebAssembly runtime loads
- Razor components render UI
- Timeline component loaded from the component DLL
- JSInterop channel calls timelineComponentJsInterop.js
- Intersection Observer API monitors element visibility
D. TailwindCSS
- Styles applied at build time (PostCSS) or runtime

1. Build → Server
2. Server → Browser (HTTP GET index.html → Wasm + DLL + JS + CSS)
3. Browser (.NET runtime → component DLL → render Timeline.razor)
4. Timeline C# logic ↔ JSInterop ↔ Intersection Observer

##### Capturing Details
- Clearly annotate:
- The solution file tying both projects.
- The component project’s dependency relationship (ProjectReference in example.csproj).
- The static assets folder (wwwroot) usage in both projects.
- Use of TailwindCSS in the example’s build pipeline.
- Use of the Intersection Observer API inside timelineComponentJsInterop.js.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Developer / Build Environment
  subgraph "Developer / Build Environment"
    timeline_sln["timeline.sln"]:::env
    Build["MSBuild / dotnet build"]:::env
    component_csproj["component/timeline-component.csproj"]:::net
    example_csproj["example/timeline.csproj"]:::net
  end

  %% Static Web Server
  subgraph "Static Web Server"
    Server["Static Web Server"]:::server
  end

  %% Browser Client
  subgraph "Browser (Client)"
    index["index.html"]:::server
    runtime[".NET WebAssembly Runtime"]:::net
    component_dll["Component DLL + assets"]:::net
    example_app["Example App WASM bundle"]:::net
    appcss["app.css"]:::css
    Timeline_rzr["Timeline.razor"]:::net
    Timeline_css["Timeline.razor.css"]:::css
    Timeline_cs["TimelineComponentJsInterop.cs"]:::net
    Script["timelineComponentJsInterop.js"]:::js
    Observer["Intersection Observer API"]:::js
    Program["Program.cs"]:::net
    AppR["App.razor"]:::net
    ImportsEx["_Imports.razor"]:::net
    IndexPage["Pages/Index.razor"]:::net
    Layout["Shared/MainLayout.razor"]:::net
  end

  %% Build outputs
  Build --> component_csproj
  Build --> example_csproj
  component_csproj --> component_dll
  example_csproj --> example_app

  %% Deploy to Server
  component_dll --> Server
  example_app --> Server
  Timeline_css --> Server
  Script --> Server
  appcss --> Server

  %% Server to Browser
  Server -->|HTTP GET index.html| index
  Server -->|HTTP GET WASM & DLL & JS & CSS| runtime
  Server -->|HTTP GET CSS| appcss
  Server -->|HTTP GET JS| Script

  %% Browser startup
  index -->|bootstraps| runtime
  runtime --> component_dll
  runtime --> example_app

  %% Example App structure
  index --> Program
  Program --> AppR
  AppR --> Layout
  AppR --> IndexPage
  AppR --> ImportsEx

  %% Timeline Component flow
  component_dll --> Timeline_rzr
  Timeline_rzr --> Timeline_css
  Timeline_rzr -->|uses C# interop bridge| Timeline_cs
  Timeline_cs -->|JS Interop call| Script
  Script -->|uses| Observer
  Observer -->|callback| Timeline_cs

  %% Click Events
  click timeline_sln "https://github.com/ypyl/blazor-timeline-component/blob/master/timeline.sln"
  click component_csproj "https://github.com/ypyl/blazor-timeline-component/blob/master/component/timeline-component.csproj"
  click example_csproj "https://github.com/ypyl/blazor-timeline-component/blob/master/example/timeline.csproj"
  click Timeline_rzr "https://github.com/ypyl/blazor-timeline-component/blob/master/component/Timeline.razor"
  click Timeline_css "https://github.com/ypyl/blazor-timeline-component/blob/master/component/Timeline.razor.css"
  click Timeline_cs "https://github.com/ypyl/blazor-timeline-component/blob/master/component/TimelineComponentJsInterop.cs"
  click Script "https://github.com/ypyl/blazor-timeline-component/blob/master/component/wwwroot/timelineComponentJsInterop.js"
  click ImportsEx "https://github.com/ypyl/blazor-timeline-component/blob/master/example/_Imports.razor"
  click example_app "https://github.com/ypyl/blazor-timeline-component/blob/master/example/timeline.csproj"
  click index "https://github.com/ypyl/blazor-timeline-component/blob/master/example/wwwroot/index.html"
  click appcss "https://github.com/ypyl/blazor-timeline-component/blob/master/example/wwwroot/css/app.css"
  click Program "https://github.com/ypyl/blazor-timeline-component/blob/master/example/Program.cs"
  click AppR "https://github.com/ypyl/blazor-timeline-component/blob/master/example/App.razor"
  click IndexPage "https://github.com/ypyl/blazor-timeline-component/blob/master/example/Pages/Index.razor"
  click Layout "https://github.com/ypyl/blazor-timeline-component/blob/master/example/Shared/MainLayout.razor"

  %% Styles
  classDef env fill:#EEEEEE,stroke:#333,stroke-width:1px
  classDef net fill:#D0E1FD,stroke:#1F4E79,stroke-width:1px
  classDef js  fill:#DFF0D8,stroke:#3C763D,stroke-width:1px
  classDef css fill:#FFF4CC,stroke:#8A6D3B,stroke-width:1px
  classDef server fill:#F2DEDE,stroke:#A94442,stroke-width:1px
```
