# tjy-gitnub/win12 architecture

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

- Interactive diagram: https://gitdiagram.com/tjy-gitnub/win12
- Repository: https://github.com/tjy-gitnub/win12

## Overview

##### Project type and purpose
- This is a single-page, front-end-only “Windows 12” web-desktop simulator built as a PWA (Progressive Web App).
- It runs entirely in the browser, uses static assets (HTML/CSS/JS), and simulates OS components (boot, desktop, start menu, apps).
- It also integrates an “AI Copilot” feature via a small Cloudflare Worker that proxies to an external AI API.

##### File structure
- Top-level HTML entry points: boot.html, bios.html, bluescreen.html, desktop.html, etc.
- module/ – reusable JS/CSS modules for window management, tabs, widgets.
- scripts/ – application kernels (e.g. calculator_kernel.js), utilities, and the AI Copilot service folder containing Cloudflare Worker code.
- pwa/ – manifest.json for PWA installation.
- sw.js – service worker script for offline caching.
- data/ – JSON/JS-based data (tasks.js, disconnected.html).
- lang/ – i18n property files and translation script.

##### README for additional insights
- Confirms PWA support and offline readiness.
- Mentions AI Copilot implementation located under scripts/AI Copilot service.
- Clarifies “no server” beyond static file hosting and the Cloudflare Worker.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client (Browser)"
        direction TB
        EntryPoints["Entry Point HTML<br/>(boot.html, bios.html, bluescreen.html, desktop.html)"]:::frontend
        UIAssets["UI CSS/JS<br/>(base.css, desktop.css, desktop.js)"]:::frontend
        subgraph "JS/CSS Modules"
            direction TB
            WindowJS["window.js"]:::frontend
            AppsJS["apps.js"]:::frontend
            TabJS["tab.js"]:::frontend
            TabCSS["tab.css"]:::frontend
            WidgetJS["widget.js"]:::frontend
            WidgetCSS["widget.css"]:::frontend
        end
        AppsStyle["apps/style/*.css"]:::frontend
        AppsIcons["apps/icons/"]:::frontend
        Manifest["PWA Manifest<br/>(pwa/manifest.json)"]:::frontend
        ServiceWorkerReg["Service Worker Registration"]:::frontend
        LocalStorage["Local Storage / IndexedDB"]:::storage
        subgraph "Offline Data & Fallback"
            direction TB
            TasksJS["tasks.js"]:::frontend
            DisconnectedHTML["disconnected.html,<br/>disconnected_dark.html"]:::frontend
        end
        subgraph "i18n / Localization"
            direction TB
            JQueryI18n["jquery.i18n.properties.js"]:::frontend
            LangEN["lang_en.properties"]:::frontend
            LangCN["lang_zh_CN.properties"]:::frontend
            LangTW["lang_zh_TW.properties"]:::frontend
            TransPy["trans.py"]:::frontend
        end
    end

    SW["Service Worker<br/>(sw.js)"]:::cache
    StaticHost["Static Hosting / CDN"]:::external
    Cloudflare["Cloudflare Worker<br/>(AI Copilot service)"]:::edge
    READMEEdge["README.md"]:::edge
    ExternalAPI["External AI API"]:::api

    %% Connections
    EntryPoints -->|"load assets"| SW
    UIAssets --> SW
    WindowJS --> SW
    AppsJS --> SW
    TabJS --> SW
    TabCSS --> SW
    WidgetJS --> SW
    WidgetCSS --> SW
    AppsStyle --> SW
    AppsIcons --> SW
    Manifest -->|"link manifest"| EntryPoints
    ServiceWorkerReg -->|"register sw"| SW
    SW -->|"HTTP GET / fetch"| StaticHost
    SW -->|"serve cached"| EntryPoints
    EntryPoints -->|"use modules & UI"| WindowJS
    EntryPoints --> LocalStorage
    EntryPoints --> TasksJS
    EntryPoints --> DisconnectedHTML
    EntryPoints --> JQueryI18n
    EntryPoints --> LangEN
    EntryPoints --> LangCN
    EntryPoints --> LangTW
    EntryPoints --> TransPy
    EntryPoints -->|"API call: fetch Copilot"| Cloudflare
    Cloudflare -->|"proxy request"| ExternalAPI
    Cloudflare --> READMEEdge

    %% Click Events
    click WindowJS "https://github.com/tjy-gitnub/win12/blob/main/module/window.js"
    click AppsJS "https://github.com/tjy-gitnub/win12/blob/main/module/apps.js"
    click TabJS "https://github.com/tjy-gitnub/win12/blob/main/module/tab.js"
    click TabCSS "https://github.com/tjy-gitnub/win12/blob/main/module/tab.css"
    click WidgetJS "https://github.com/tjy-gitnub/win12/blob/main/module/widget.js"
    click WidgetCSS "https://github.com/tjy-gitnub/win12/blob/main/module/widget.css"
    click AppsStyle "https://github.com/tjy-gitnub/win12/tree/main/apps/style"
    click AppsIcons "https://github.com/tjy-gitnub/win12/tree/main/apps/icons/"
    click SW "https://github.com/tjy-gitnub/win12/blob/main/sw.js"
    click Manifest "https://github.com/tjy-gitnub/win12/blob/main/pwa/manifest.json"
    click Cloudflare "https://github.com/tjy-gitnub/win12/blob/main/scripts/AI Copilot service/Cloudflare AI.js"
    click READMEEdge "https://github.com/tjy-gitnub/win12/blob/main/scripts/AI Copilot service/README.md"
    click JQueryI18n "https://github.com/tjy-gitnub/win12/blob/main/scripts/jquery.i18n.properties.js"
    click LangEN "https://github.com/tjy-gitnub/win12/blob/main/lang/lang_en.properties"
    click LangCN "https://github.com/tjy-gitnub/win12/blob/main/lang/lang_zh_CN.properties"
    click LangTW "https://github.com/tjy-gitnub/win12/blob/main/lang/lang_zh_TW.properties"
    click TransPy "https://github.com/tjy-gitnub/win12/blob/main/lang/trans.py"
    click TasksJS "https://github.com/tjy-gitnub/win12/blob/main/data/tasks.js"
    click DisconnectedHTML "https://github.com/tjy-gitnub/win12/blob/main/data/disconnected.html"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#0288D1,color:#000
    classDef cache fill:#E8F5E9,stroke:#2E7D32,color:#000
    classDef edge fill:#FFF3E0,stroke:#EF6C00,color:#000
    classDef api fill:#FFEBEE,stroke:#C62828,color:#000
    classDef external fill:#ECEFF1,stroke:#546E7A,color:#000
    classDef storage fill:#F3E5F5,stroke:#6A1B9A,color:#000
```
