# thatopen/engine_ui-components architecture

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

- Interactive diagram: https://gitdiagram.com/thatopen/engine_ui-components
- Repository: https://github.com/thatopen/engine_ui-components

## Overview

##### Project type and purpose
- This is a monorepo library of Web Components for Building Information Modeling (BIM) UI, built with Lit.
- It contains two main packages:
- @thatopen/ui (core UI primitives)
- @thatopen/ui-obc (pre-built functional UIs that wrap That Open Engine components)
- The repo also provides a catalog of static examples demonstrating each component in action.

##### File structure
- Top-level:
- .github/ – CI workflows for publishing to NPM and releasing
- examples/ – standalone HTML demos for each component
- packages/
– core/ – the @thatopen/ui package
– obc/  – the @thatopen/ui-obc package
- resources/ – shared assets, sample IFC, shaders, scripts
- config files: ESLint, Jest, tsconfig, Vite configs, Yarn Berry setup
- packages/core/src and packages/obc/src each follow a folder-per-component pattern, with index.ts entry points and example fixtures.

##### README insights
- Monorepo organized to minimize bundle size via peerDependencies.
- Core provides raw Web Components (buttons, panels, tables, inputs).
- OBC provides ready-to-use UIs that wire core components to That Open Engine functionalities (e.g., load IFC, show classifications).
- Web Components are framework-agnostic, authored with Lit.

##### Main components & relationships
a. Components
- Monorepo Root
- Package Manager (Yarn Berry) & Build Tool (Vite)
- @thatopen/ui (core library)
- @thatopen/ui-obc (functional UI library)
- Examples site (static HTML + built assets)
- External dependencies: @thatopen/components, @thatopen/components-front
- CI/CD: GitHub Actions → NPM registry
b. Interactions
- Core and OBC packages import shared build configs, TypeScript settings, and Lit.
- OBC has peerDependencies on core + engine components.
- The Examples folder imports built outputs (via vite.config-examples) to render demos.
- CI workflows trigger on push/release tags, build packages, run tests, and publish.
c. Architectural patterns
- Monorepo with independent packages (package-per-component)
- Component-driven development (each component folder has code + example)
- Peer-dependency isolation to optimize bundle size
- Shared build tooling (Vite + Yarn workspaces)
d. Key technologies
- Lit (Web Components authoring)
- Vite (dev server & bundler)
- Yarn 3 (workspaces)
- TypeScript
- Jest (unit tests)
- GitHub Actions (CI/CD)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Monorepo" 
        direction TB
        MR["Monorepo Root"]:::internal
        YV["Yarn 3 Workspaces & Vite"]:::build
        Core["packages/core"]:::internal
        Obc["packages/obc"]:::internal
        Ex["examples"]:::internal
        Res["resources"]:::internal
        ESL[".eslintrc.cjs"]:::buildConfig
        JESTCFG["jest.config.ts & tsconfig.jest.json"]:::buildConfig
        PKG["package.json & yarn.lock"]:::internal
    end

    GH["GitHub Actions"]:::ci
    NPM["NPM Registry"]:::external
    EC["@thatopen/components"]:::external
    ECF["@thatopen/components-front"]:::external
    EWS["Examples Web Site"]:::external

    Core -->|"builds with"| YV
    Obc -->|"builds with"| YV
    Ex -->|"serves demos with"| YV

    Obc -->|"peerDependency"| Core
    Obc -->|"peerDependency"| EC
    Obc -->|"peerDependency"| ECF

    Ex -->|"consumes outputs"| Core
    Ex -->|"consumes outputs"| Obc
    Ex -->|"serves to users"| EWS

    GH -->|"triggers CI"| MR
    GH -->|"runs build & tests"| YV
    GH -->|"tests packages"| Core
    GH -->|"tests packages"| Obc
    GH -->|"publishes"| NPM

    classDef internal fill:#E0F7FA,stroke:#006064,color:#004D40
    classDef external fill:#E8F5E9,stroke:#2E7D32,color:#1B5E20
    classDef build fill:#FFF3E0,stroke:#EF6C00,color:#E65100
    classDef ci fill:#FFE0B2,stroke:#FB8C00,color:#BF360C
    classDef buildConfig fill:#F3E5F5,stroke:#8E24AA,color:#4A148C

    click MR "https://github.com/thatopen/engine_ui-components/tree/main//"
    click YV "https://github.com/thatopen/engine_ui-components/blob/main/vite.config.ts"
    click YV "https://github.com/thatopen/engine_ui-components/blob/main/vite.config-examples.ts"
    click GH "https://github.com/thatopen/engine_ui-components/blob/main/.github/workflows/publish-npm.yml"
    click GH "https://github.com/thatopen/engine_ui-components/blob/main/.github/workflows/release-please.yml"
    click Core "https://github.com/thatopen/engine_ui-components/tree/main/packages/core/"
    click Core "https://github.com/thatopen/engine_ui-components/tree/main/packages/core/src/components/"
    click Core "https://github.com/thatopen/engine_ui-components/blob/main/packages/core/src/index.ts"
    click Core "https://github.com/thatopen/engine_ui-components/blob/main/packages/core/vite.config.ts"
    click Core "https://github.com/thatopen/engine_ui-components/blob/main/packages/core/tsconfig.json"
    click Core "https://github.com/thatopen/engine_ui-components/blob/main/packages/core/tsconfig-build.json"
    click Obc "https://github.com/thatopen/engine_ui-components/tree/main/packages/obc/"
    click Obc "https://github.com/thatopen/engine_ui-components/tree/main/packages/obc/src/components/"
    click Obc "https://github.com/thatopen/engine_ui-components/tree/main/packages/obc/src/core/"
    click Obc "https://github.com/thatopen/engine_ui-components/blob/main/packages/obc/src/index.ts"
    click Obc "https://github.com/thatopen/engine_ui-components/blob/main/packages/obc/vite.config.ts"
    click Obc "https://github.com/thatopen/engine_ui-components/blob/main/packages/obc/tsconfig.json"
    click Obc "https://github.com/thatopen/engine_ui-components/blob/main/packages/obc/tsconfig-build.json"
    click Ex "https://github.com/thatopen/engine_ui-components/tree/main/examples/"
    click Res "https://github.com/thatopen/engine_ui-components/tree/main/resources/"
    click ESL "https://github.com/thatopen/engine_ui-components/blob/main/.eslintrc.cjs"
    click JESTCFG "https://github.com/thatopen/engine_ui-components/blob/main/jest.config.ts"
    click JESTCFG "https://github.com/thatopen/engine_ui-components/blob/main/tsconfig.jest.json"
    click PKG "https://github.com/thatopen/engine_ui-components/blob/main/package.json"
    click PKG "https://github.com/thatopen/engine_ui-components/blob/main/yarn.lock"
```
