# Graph View This document describes the current Graph View design principles and requirements. It is the source of truth for how the global Graph View, the page/block graph panel, the Datascript graph builders, and the Pixi renderer should behave. ## Source Map Primary source files: - `src/main/frontend/routes.cljs` mounts `/graph` to `frontend.components.graph/global-graph`. - `src/main/frontend/components/graph.cljs` owns the global Graph View UI, settings, filtering, worker loading, and the bridge into `graph-2d`. - `src/main/frontend/components/page.cljs` reuses `graph-2d` for the page/block graph panel in the right sidebar. - `src/main/frontend/components/graph_actions.cljs` owns node activation, sidebar opening, redirect refs, and node preview popups. - `src/main/frontend/extensions/graph.cljs` is the Rum wrapper around the Pixi renderer and incremental update API. - `src/main/frontend/extensions/graph/pixi.cljs` owns the Pixi application, layers, event handling, drawing, labels, runtime instance management, and FPS overlay. - `src/main/frontend/extensions/graph/pixi/logic.cljs` owns pure graph layout, visibility, highlighting, zoom, label selection, edge runs, and geometry helpers. - `src/main/frontend/common/graph_view.cljs` builds graph node/link data from a Datascript db. - `src/main/frontend/worker/db_core.cljs` exposes `:thread-api/build-graph`, which delegates to `frontend.common.graph-view`. - `src/main/frontend/extensions/graph.css` styles the global Graph View toolbar, settings panel, time travel control, reset control, accessibility panel, and canvas shell. Generated files under `dist/static/**/cljs-runtime/` are compiled artifacts and are not the source of truth. ## Core Principles - Graph View is a relationship browser. It should show meaningful relationships between visible graph entities without inventing synthetic product modes. - Layout is a stable semantic contract. Performance work may optimize data structures, iteration, rendering, culling, and hit testing, but must not change layout placement rules unless the product behavior explicitly changes. - Hidden nodes are not interactive. If a node is hidden by focus, selection, time travel, journal filtering, tag filtering, grid sampling, or viewport culling, it must not intercept clicks, drags, hover, or edge hit testing. - Focus and selection are inspection states, not lock states. Users can still drag visible nodes while a tag is focused or a node is selected. - Selected or focused neighborhoods use smart labels. Related labels should be shown when possible, but label selection must cull overlap by current screen occupancy. - The renderer should target smooth interaction. The Pixi ticker target is `120` FPS, and zooming into object detail must avoid unnecessary offscreen work so the bottom FPS overlay stays close to the display refresh budget. - The all-pages and tags-and-objects modes should share common renderer paths where possible. Mode-specific behavior belongs in data building, layout, and visibility rules, not duplicated UI plumbing. - Task status preview / Task view is not part of Graph View. Do not reintroduce task-specific graph modes, task-specific preview surfaces, or task-specific status grouping in the Pixi renderer. ## Runtime Entry Points The global graph route is `/graph`. The shortcut config binds `:go/graph-view` to `g g`, which calls `frontend.handler.route/redirect-to-graph-view!` and navigates to the same route. The page/block graph is separate from `/graph`. It is rendered by `frontend.components.page/page-graph` in the right sidebar. It calls the same worker API with `:type :page` for page entities and `:type :block` otherwise, then renders the result with `graph-2d` in `:page` renderer mode. `frontend.handler.graph` is adjacent graph metadata plumbing for repository list metadata such as `created-at` and `last-seen-at`. It does not participate in the Pixi Graph View rendering pipeline. ## Worker Data Pipeline The frontend never reads Datascript graph data directly for Graph View. It calls the db worker: ```clojure (state/