# jelosus2/bd2-l2d-viewer architecture

> Architecture diagram of the GitHub repository jelosus2/bd2-l2d-viewer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jelosus2/bd2-l2d-viewer
- Repository: https://github.com/jelosus2/bd2-l2d-viewer

## Overview

#### Purpose and Entry Points
A static Brown Dust 2 character-animation viewer. It presents bundled character Spine/L2D-style animation assets and battle-ready voice clips in a browser. The application boots from `index.html` through `src/main.ts`, mounting the root UI in `src/App.vue`.

#### Application Shell and UI Composition
`src/App.vue` coordinates the viewer experience. Navigation, character selection, animation selection, settings, tutorials, changelog, and asset-upload flows are separated into Vue components:
- `src/components/Navbar.vue`
- `src/components/CharacterSideBar.vue`
- `src/components/AnimationSideBar.vue`
- `src/components/SettingsModal.vue`
- `src/components/FeatureTutorial.vue`

#### Viewer Runtime Boundary
`src/components/SpineViewer.vue` is the rendering boundary between Vue state/UI and the Spine player/runtime. Its internal player typing is isolated in `src/types/spine-player-internal.d.ts`. Character selections and animation choices should flow into this component; rendering, camera/layer controls, and runtime-specific concerns should remain behind it.

#### State, Selection, and URL Flow
Two centralized stores represent the main client state domains:
- `src/stores/characterStore.ts` for selected character/animation-oriented state.
- `src/stores/settingsStore.ts` for viewer preferences.

Catalog and mapping utilities provide static lookup data rather than a backend: `src/utils/character_list.ts`, `src/utils/cutscene_mappings.ts`, and `src/utils/charIcons.ts`. `src/utils/urlSync.ts` indicates selection/settings can be reflected in or restored from browser URLs, making URLs a public state boundary.

#### Bundled Asset Catalog
The repository carries its own media corpus. Character and NPC skeletal assets are organized by numeric ID under `src/assets/spines`, with `.atlas` and `.skel` pairs, optional cutscene variants, and occasional dating/illustration variants; e.g. `src/assets/spines/000101/`, `src/assets/spines/003803/cutscene/glow/`, and `src/assets/spines/066403/dating/`. Character battle-ready audio is local WebM media grouped by character and JP/KR locale under `src/assets/audios/`.

This static-file layout is a key contract: catalog IDs and special mappings must resolve to exact asset directories/files, including exceptional naming cases.

#### User-Provided Asset Paths
The app supports local customization/import workflows through `src/components/UploadSpineModal.vue` and `src/components/UploadBackgroundModal.vue`. These are distinct from the curated bundled catalog and should be treated as browser-session/client-side inputs unless implementation establishes persistence elsewhere.

#### Build and Deployment
This is a TypeScript/Vue frontend built with Vite (`vite.config.ts`) and styled from `src/assets/main.css` with Tailwind configuration in `tailwind.config.ts`. `scripts/copy-assets.js` is architecturally relevant because the large binary media set likely needs explicit copying into build output. Deployment is static hosting via GitHub Pages automation: `.github/workflows/gh-pages.yml`. No server, database, authentication system, or external runtime service is evident from the supplied tree.

Main entry points: [`src/components/SpineViewer.vue`](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/SpineViewer.vue) (Spine viewer), [`src/App.vue`](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/App.vue) (Application shell), [`src/stores/characterStore.ts`](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/stores/characterStore.ts) (Character selection state), [`scripts/copy-assets.js`](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/scripts/copy-assets.js) (Asset copy step)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser application"]
  node_html["HTML entry<br/>entry point<br/>[index.html]"]
  node_main["Vue bootstrap<br/>TypeScript entry<br/>[main.ts]"]
  node_app["Application shell<br/>Vue root<br/>[App.vue]"]
  node_navigation["Navigation<br/>Vue component<br/>[Navbar.vue]"]
  node_selection_ui["Character and animation selectors<br/>Vue components"]
  node_animation_ui["Animation selector<br/>Vue component"]
  node_settings_ui["Settings and tutorial UI<br/>Vue components<br/>[SettingsModal.vue]"]
  node_viewer["Spine viewer<br/>rendering boundary<br/>[SpineViewer.vue]"]
  node_spine_types["Player internal types<br/>TypeScript declarations"]
  node_character_state["Character selection state<br/>client store<br/>[characterStore.ts]"]
  node_settings_state["Viewer preferences<br/>client store<br/>[settingsStore.ts]"]
  node_url_sync["URL state sync<br/>browser URL boundary<br/>[urlSync.ts]"]
  node_uploads["Local asset uploads<br/>Vue import UI"]
end

subgraph group_catalog["Static catalog"]
  node_catalog_data["Catalog mappings<br/>static lookup data<br/>[character_list.ts]"]
  node_spine_assets[("Skeletal asset corpus<br/>bundled media")]
  node_audio_assets[("Voice clip corpus<br/>bundled media")]
end

subgraph group_delivery["Build and deployment"]
  node_styles["Application styles<br/>CSS<br/>[main.css]"]
  node_vite["Vite build<br/>build configuration<br/>[vite.config.ts]"]
  node_asset_copy["Asset copy step<br/>build script<br/>[copy-assets.js]"]
  node_github_pages["GitHub Pages deploy<br/>CI workflow<br/>[gh-pages.yml]"]
end

node_html -->|"loads"| node_main
node_main -->|"mounts"| node_app
node_app -->|"composes"| node_navigation
node_app -->|"composes"| node_selection_ui
node_app -->|"composes"| node_animation_ui
node_app -->|"composes"| node_settings_ui
node_app -->|"drives"| node_viewer
node_selection_ui -->|"updates"| node_character_state
node_animation_ui -->|"updates"| node_character_state
node_settings_ui -->|"updates"| node_settings_state
node_character_state -->|"selected asset and animation"| node_viewer
node_settings_state -->|"viewer preferences"| node_viewer
node_url_sync -->|"restores and reflects"| node_character_state
node_url_sync -->|"restores and reflects"| node_settings_state
node_catalog_data -->|"catalog lookup"| node_character_state
node_character_state -->|"resolves asset IDs"| node_spine_assets
node_viewer -->|"loads skeletons"| node_spine_assets
node_viewer -->|"plays voice clips"| node_audio_assets
node_spine_types -.->|"types player internals"| node_viewer
node_uploads -->|"provides local inputs"| node_viewer
node_vite -->|"build includes"| node_asset_copy
node_asset_copy -->|"copies"| node_spine_assets
node_asset_copy -->|"copies"| node_audio_assets
node_github_pages -->|"builds and deploys"| node_vite

click node_html "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/index.html"
click node_main "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/main.ts"
click node_app "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/App.vue"
click node_navigation "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/Navbar.vue"
click node_selection_ui "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/CharacterSideBar.vue"
click node_animation_ui "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/AnimationSideBar.vue"
click node_settings_ui "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/SettingsModal.vue"
click node_viewer "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/SpineViewer.vue"
click node_spine_types "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/types/spine-player-internal.d.ts"
click node_character_state "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/stores/characterStore.ts"
click node_settings_state "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/stores/settingsStore.ts"
click node_url_sync "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/utils/urlSync.ts"
click node_uploads "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/UploadSpineModal.vue"
click node_catalog_data "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/utils/character_list.ts"
click node_spine_assets "https://github.com/jelosus2/bd2-l2d-viewer/tree/main/src/assets/spines"
click node_styles "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/assets/main.css"
click node_vite "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/vite.config.ts"
click node_asset_copy "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/scripts/copy-assets.js"
click node_github_pages "https://github.com/jelosus2/bd2-l2d-viewer/blob/main/.github/workflows/gh-pages.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_html,node_main,node_app,node_navigation,node_selection_ui,node_animation_ui,node_settings_ui,node_viewer,node_spine_types,node_character_state,node_settings_state,node_url_sync,node_uploads toneBlue
class node_catalog_data,node_spine_assets,node_audio_assets toneAmber
class node_styles,node_vite,node_asset_copy,node_github_pages toneMint
```

## Components

### Browser application

- [HTML entry](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/index.html): entry point · `index.html`
- [Vue bootstrap](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/main.ts): TypeScript entry · `src/main.ts`
- [Application shell](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/App.vue): Vue root · `src/App.vue`
- [Navigation](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/Navbar.vue): Vue component · `src/components/Navbar.vue`
- [Character and animation selectors](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/CharacterSideBar.vue): Vue components · `src/components/CharacterSideBar.vue`
- [Animation selector](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/AnimationSideBar.vue): Vue component · `src/components/AnimationSideBar.vue`
- [Settings and tutorial UI](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/SettingsModal.vue): Vue components · `src/components/SettingsModal.vue`
- [Spine viewer](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/SpineViewer.vue): rendering boundary · Encapsulates player, camera, layer, and runtime concerns. · `src/components/SpineViewer.vue`
- [Player internal types](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/types/spine-player-internal.d.ts): TypeScript declarations · `src/types/spine-player-internal.d.ts`
- [Character selection state](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/stores/characterStore.ts): client store · `src/stores/characterStore.ts`
- [Viewer preferences](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/stores/settingsStore.ts): client store · `src/stores/settingsStore.ts`
- [URL state sync](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/utils/urlSync.ts): browser URL boundary · Restores and reflects selection and settings in URLs. · `src/utils/urlSync.ts`
- [Local asset uploads](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/components/UploadSpineModal.vue): Vue import UI · Session-scoped user-provided Spine and background inputs. · `src/components/UploadSpineModal.vue`

### Static catalog

- [Catalog mappings](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/utils/character_list.ts): static lookup data · `src/utils/character_list.ts`
- [Skeletal asset corpus](https://github.com/jelosus2/bd2-l2d-viewer/tree/main/src/assets/spines): bundled media · ID-based atlas and skeleton directories, including special variants. · `src/assets/spines`
- **Voice clip corpus**: bundled media · Character audio grouped by JP and KR locale.

### Build and deployment

- [Application styles](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/src/assets/main.css): CSS · `src/assets/main.css`
- [Vite build](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/vite.config.ts): build configuration · `vite.config.ts`
- [Asset copy step](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/scripts/copy-assets.js): build script · Copies large binary media into build output. · `scripts/copy-assets.js`
- [GitHub Pages deploy](https://github.com/jelosus2/bd2-l2d-viewer/blob/main/.github/workflows/gh-pages.yml): CI workflow · `.github/workflows/gh-pages.yml`

## Connections

- HTML entry → Vue bootstrap: loads
- Vue bootstrap → Application shell: mounts
- Application shell → Navigation: composes
- Application shell → Character and animation selectors: composes
- Application shell → Animation selector: composes
- Application shell → Settings and tutorial UI: composes
- Application shell → Spine viewer: drives
- Character and animation selectors → Character selection state: updates
- Animation selector → Character selection state: updates
- Settings and tutorial UI → Viewer preferences: updates
- Character selection state → Spine viewer: selected asset and animation
- Viewer preferences → Spine viewer: viewer preferences
- URL state sync → Character selection state: restores and reflects
- URL state sync → Viewer preferences: restores and reflects
- Catalog mappings → Character selection state: catalog lookup
- Character selection state → Skeletal asset corpus: resolves asset IDs
- Spine viewer → Skeletal asset corpus: loads skeletons
- Spine viewer → Voice clip corpus: plays voice clips
- Player internal types → Spine viewer: types player internals
- Local asset uploads → Spine viewer: provides local inputs
- Vite build → Asset copy step: build includes
- Asset copy step → Skeletal asset corpus: copies
- Asset copy step → Voice clip corpus: copies
- GitHub Pages deploy → Vite build: builds and deploys
