You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+34-67Lines changed: 34 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,27 +2,20 @@
2
2
3
3
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
5
-
## Active Migration
5
+
Arena3Dweb is a web application for interactive 3D visualization of multilayered networks: **FastAPI backend** (Python, `uv`) + **Vite / TypeScript / Three.js frontend** (npm).
6
6
7
-
This repository is being migrated from R/Shiny to FastAPI + Vite + TypeScript + Three.js (npm).
8
-
9
-
-**`SPEC.md`** — architecture decisions, chosen stack, design patterns, API contract, and rationale. Read this first to understand why things are structured the way they are.
10
-
-**`PLAN.md`** — phased implementation checklist with checkboxes. Check this to see what has been done and what remains before starting any work.
11
-
-**`MIGRATION.md`** — maps each old R/Shiny file to its new equivalent; old files are deleted only after their replacement is tested.
12
-
13
-
If you are on the `v3` branch, the presence of old R/Shiny files (`server.R`, `functions/`, `views/`, `www/js/`) means those pieces have not been ported yet — they are the living specification for what the new code should do.
7
+
The app was migrated from R/Shiny to this stack. All R/Shiny source is gone; the migration history lives in:
8
+
-**`SPEC.md`** — architecture decisions, chosen stack, design patterns, API contract, and rationale.
- Algorithms use **python-igraph** — same C core as R's igraph, so layouts/clustering/topology port 1:1.
75
60
76
-
## Architecture Overview
61
+
### Frontend (`frontend/src/`)
62
+
-`main.ts` — entry point: fetch config → set up Three.js → mount canvas → wire panels + listeners → `animate()`. Exposes `window.__arena = { ctx, history }` as a Playwright test hook (the WebGL canvas is opaque to the a11y tree).
-`actions/` — one module per domain (`network`, `layout`, `layer`, `node`, `edge`, `labels`, `themes`, `screen`, `canvas_controls`, `nav_controls`, `drag_controls`, `right_click_menu`, `session`). These mutate the object model + `ctx`.
65
+
-`commands/` — `Command` interface + `CommandHistory` (undo/redo); `scene.ts` holds the concrete commands. Every scene mutation that should be undoable routes through a command.
66
+
-`ui/` — one module per navbar panel (`home`, `file`, `layouts`, `scene`, `layer`, `node`, `edge`, `data`, `fps`, `help`), each filling its `#panel-*` pane with Bootstrap DOM and wiring controls to `actions`/`commands`.
67
+
-`bus/` — typed `EventBus` singleton (returns unsubscribe fns); `store/` — typed `AppState` store. Together they replace the old Shiny input/output sync.
68
+
-`api/client.ts` — hand-written typed client mirroring the Pydantic models.
77
69
78
-
This is an **R/Shiny + Three.js** web application for interactive 3D visualization of multilayered networks.
79
-
80
-
### R/Shiny Layer (backend)
81
-
-`global.R` — loaded once; imports libraries
82
-
-`ui.R` — loads all JS/CSS, defines the navbar tab layout (Home, File, Layer Selection & Layouts, Scene Actions, Layer Actions, Node Actions, Edge Actions, View Data, FPS, Help)
83
-
-`server.R` — wires all `observeEvent` handlers; calls `initializeServerApp()` on startup
84
-
-`views/` — one R file per UI tab (e.g. `file.R`, `layer.R`), each exporting a `generate*Div()` function
85
-
-`functions/` — server-side logic split by domain:
86
-
-`input.R` — network file upload and validation
87
-
-`init.R` — app startup: pushes global constants to JS, attaches download handler
88
-
-`js_handling.R` — helpers to sync JS state back to Shiny inputs
-**Object actions** (`object_actions/`) — functions for each entity type: `screen.js`, `network.js`, `layout.js`, `layer.js`, `node.js`, `edge.js`, `labels.js`, `themes.js`, `canvas_controls.js`, `right_click_menu.js`
98
-
-**Shiny bridge** — `rshiny_handlers.js` registers all `Shiny.addCustomMessageHandler("handler_*", ...)` callbacks; `rshiny_update.js` sends data from JS back to Shiny
99
-
-**Config** (`config/`) — `global_variables.js` (runtime globals initialized from R via `handler_initializeGlobals`), `static_variables.js` (constants like color palettes, geometry sizes)
- Constants (MAX_LAYERS, MAX_EDGES, MAX_CHANNELS, channel colors) are defined in R config and pushed to JS globals at startup via `handler_initializeGlobals`
-**Within frontend**: components emit/subscribe on the `EventBus` and read/write the `store`; the render loop reacts to `ctx` flags (`renderInterLayerEdgesFlag`, label flags, etc.).
106
73
107
74
### Network Data Model
108
-
- Networks are uploaded as TSV with mandatory columns:`SourceNode`, `SourceLayer`, `TargetNode`, `TargetLayer` (optional: `Weight`, `Channel`, edge color columns)
109
-
-Sessions are exported/imported as JSON containing full node/edge/layer state
110
-
-The REST API endpoint accepts a URL parameter to load a network directly from an external application
75
+
- Networks upload as TSV with mandatory columns `SourceNode`, `SourceLayer`, `TargetNode`, `TargetLayer` (optional: `Weight`, `Channel`, edge color columns).
0 commit comments