Code reference detail
graph-ui-state.ts
packages/extension/src/ideas_summary_module/shared/graph-ui-state.ts
| Idea | Status | Tags | Summary | Katz |
|---|---|---|---|---|
| persistence_tiers | done | Three persistence tiers — pick the shallowest that matches lifetime: 1. `acquireVsCodeApi().getState` / `setState` — ephemeral webview session ( pane expand / heights, active tab ). 2. `ExtensionContext.workspaceState` — durable UI prefs shared across reloads ( graph / table UI keys under `reqlan.ideasSummary.*`, optionally per-base ). Normalize + default on read ( `normalizeGraphUiState` / table defaults ); never trust raw JSON shape. 3. `ExtensionContext.globalState` — install / user-level flags ( e. g. onboarding ), not pane view-models. Debounce persist posts ( ~ 200 – 250 ms ) when UI controls churn. Related: [webview_app_state]. | 0.050 | |
| scope | TypeScript package standards for `packages/extension` ( npm `reqlan-extension` ), especially UI state. Complements [development_core.rust_mindset] and [extension_architecture.state_machine_mindset]. Webview inventory: [webview_doc.webview]. Package role: [core_architecture.extension_package]. | 0.040 | ||
| ui_state_management | done | Extension UI state is explicit, typed, and layered — not a single global store shared across host and webview. Choose the layer by lifetime and owner: - Host session / durable prefs live in the extension process ( `ExtensionContext`, plain modules ). - Webview view-models live in Svelte 5 runes ( `$state` / `$derived` / `$effect` ). - Cross-boundary traffic uses typed `postMessage` contracts only. Prefer small state machines ( named phases, request ids, clear transitions ) over ad-hoc flags. Related: [webview_app_state], [persistence_tiers], [zustand_boundary], [host_webview_ownership]. | 0.080 | |
| graph_design | The graph should show nodes for ideas and files and edges for references. Used by Ideas Summary, activity-bar minigraph, and export previews. | 0.040 | ||
| graph_label_modes | done | Every interactive graph should provide a Labels control that cycles auto ( default ), on, and off without changing graph membership. On forces full opacity; off hides all labels; auto follows [graph_label_auto]. Reset / default restore auto. Ideas Summary: control in ["../../../packages/extension/webviews/ideas-summary/components/GraphControls.svelte"], mode persisted via ["../workspace-summary/ideas_summary/graphical_graph.rq".graph_ui_persistence]. HTML export: control in ["../../../crates/reqlan-export/src/html_template/mod.rs"] / ["../../../crates/reqlan-export/assets/app.js"]. Driven by the same viewport zoom as [view_controls]. | 0.148 | |
| ideas_summary_base_scope | done | bases, ideas-summary, multi-base | Ideas Summary is scoped to one [bases.base] at a time. - Active base defaults to the longest-matching base root for the focused editor ( [bases.implied_context] ). - Chrome includes an explicit base switcher; Overview, Bases, Ideas, Ideasets, Attributes, References, Graph, Timeline, and Index tabs bind to the selected base's index only ( Bases lists all discovered bases; Index is last ). - Switching base is a pointer swap ( [bases.active_base_switch] ): pin via `setActiveBaseId`, rebind status / tables / graph UI immediately — do not await sync on the switch call; not-ready bases get fire-and-forget open + soft-sync catch-up. - Graph UI persistence is per-base: workspaceState key `reqlan.ideasSummary.graphUi.<baseId>` via [graph_ui_state]. - Activity bar " Open in Ideas Summary " passes the current active base id into [ideas_summary_panel]. - No merged cross-base tables or graphs in this pass ( [bases.multi_base_environment] ). | 0.081 |
| file_treatment_toggle | done | Toolbar dropdown selects how hosting `.rq` files ( implicit ideasets ) appear in the graph — distinct from explicit AST `ideaset` declarations and from external `file:` reference nodes. Options ( with info tooltips / help text ): - invisible / Hidden — no file containers or file leaf nodes; ideas float free - compound — one compound parent per hosting file ( basename label ); nests under folder / tag compounds when Controls → Compound is also on. Containers are draggable ( members move with the box; live physics pins descendants while dragging ). Clicking the title opens the file; double-click also opens. - linked / Linked nodes ( default ) — synthetic ideaset-styled leaf per hosting file ( `rq-file:…` ) with `ideaset_member` edges to ideas in that file; click / dbl-click opens the hosting file like other nodes. Client reshape via `applyFileTreatment` in ["../../../../packages/extension/webviews/shared/graph/file-treatment.ts"]; no re-query on mode flip. Ideas Summary: `FileTreatmentSelect` on GraphControls; persisted as `fileTreatment` in [graph_ui_persistence]. HTML export: same three options via a select; compound boxes are hittable / draggable with clickable titles; linked nodes carry `pageUrl` / `hostFilePageUrl` for navigation. Related: [graphical_graph], [ui_controls], [webview_export_graph_parity], ["../../../ontology.rq".file], ["../../../ontology.rq".ideaset], [html_export_graph_page]. | 0.170 | |
| graph_ui_persistence | Key and Controls state is stored in VS Code ExtensionContext. workspaceState under key GRAPH_UI_WORKSPACE_STATE_KEY ( reqlan. ideasSummary. graphUi ). Shape and normalisation live in ["../../../../packages/extension/src/ideas_summary_module/shared/graph-ui-state.ts"]; the host reads / writes it from ["../../../../packages/extension/src/ideas_summary_module/ideas-summary-panel.ts"]. On webview ready the extension posts graphUiState; the webview posts persistGraphUiState ( debounced ) whenever AppState. patchGraphUi runs in ["../../../../packages/extension/webviews/ideas-summary/state/app.svelte.ts"]. Persisted fields: showKey, showControls, hiddenNodeTypes, layoutId, useCompound, compoundBasisId, animatePhysics, labelMode, fileTreatment, maxNodes, truncationBasis, and the five physics sliders ( gravity, repulsion, linkStrength, linkDistance, damping ). GraphView in ["../../../../packages/extension/webviews/ideas-summary/components/GraphView.svelte"] treats app. graph. ui as the source of truth and applies layout / physics / hidden types / label mode / fileTreatment to GraphCyController when those fields change. The first graph load waits for graphUiState so restored node budget is included in loadGraph. | 0.165 | ||
| graphical_graph | There should be a tab that renders requirement ideas and references as a force-directed web. The graph tab lives in the Ideas Summary webview per [ideas_summary]. UI is implemented in ["../../../../packages/extension/webviews/ideas-summary/components/GraphView.svelte"]. Graph slices are built in ["../../../../packages/analytical/src/index-store/webview-graph-queries.ts"] and served by ["../../../../packages/extension/src/ideas_summary_module/ideas-summary-panel.ts"]. By default the view focuses on the active editor file's first idea; without a focus it shows a capped slice of matching ideas rather than dumping the full graph. Users can filter by search text, path, multi-select @ status, and multi-select tags per [graph_status_tag_filters]. An " Indirect references " toggle expands neighbourhood depth from 1 to 2 hops. A " Wildcard refs " toggle includes or hides edges expanded from path + idea wildcards per [wildcard_refs_toggle] ["@/reqlan rq/language/imports.rq".wildcard_references] A " Files " dropdown selects hosting- `.rq` treatment per [file_treatment_toggle] ( hidden / compound containers / linked ideaset nodes ), with per-option info tooltips. Interactive graph controls that also exist on HTML export must stay aligned per [webview_export_graph_parity]. Clicking a node opens its source; double-click or " Focus graph " recenters the slice on that idea. Linked file ideaset nodes and file-compound titles open the hosting `.rq` file per [file_treatment_toggle]. External file references render as dashed edges to file nodes; wildcard-fan-out edges render dotted. A toggleable key explains node colours and edge styles and toggles node-type visibility per [key_panel_toggle]; a toggleable [control_panel] exposes layout, physics, and node-budget settings. Key and Controls state persist per workspace via [graph_ui_persistence]. Pan, zoom, and drag repositioning per [view_controls]. [manual_reframe] via " Fit to view " in [ui_controls]; [auto_reframe] when the loaded node set changes; [reframe_animation] for smooth transitions after the first paint. Node text labels per [graph_labels], [graph_label_modes], and [graph_label_auto]. Layout, compound grouping, and live physics behaviour per [layout_physics], [layout_options], [physics_options], and [compound_graph]. Cytoscape lifecycle and threading constraints per [graph_cy_controller] and [webview_threading]. | 0.207 |
Reference labels
"../../../../packages/extension/src/ideas_summary_module/shared/graph-ui-state.ts", "../../../packages/extension/src/ideas_summary_module/shared/graph-ui-state.ts", "../../packages/extension/src/ideas_summary_module/shared/graph-ui-state.ts", ../../../../packages/extension/src/ideas_summary_module/shared/graph-ui-state.ts, ../../../packages/extension/src/ideas_summary_module/shared/graph-ui-state.ts, ../../packages/extension/src/ideas_summary_module/shared/graph-ui-state.ts