Code reference detail
app.svelte.ts
packages/extension/webviews/ideas-summary/state/app.svelte.ts
| Idea | Status | Tags | Summary | Katz |
|---|---|---|---|---|
| imperative_view_controllers | done | Heavy imperative widgets ( Cytoscape graph ) keep lifecycle state on a controller class ( `GraphCyController` ), not inside AppState `$state` fields. AppState holds query / slice / loading / error and persisted UI prefs; the component holds the controller instance. See ["../extension/presentation/graph.rq".webview_threading] and ["../extension/workspace-summary/ideas_summary/graphical_graph.rq".graph_loading]. | 0.040 | |
| 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 | |
| webview_app_state | done | Complex webviews ( activity bar, Ideas Summary ) own a single `AppState` class in `state/app.svelte.ts`. Fields that drive UI are Svelte 5 `$state` properties on that class; side effects and host I / O are methods. Export one module singleton ( `export const app = new AppState()` ) and inject it via [svelte_app_context]. Do not use `svelte/store` writable / readable stores for new UI, and do not put zustand inside webview code ( [zustand_boundary] ). Simple panels ( export form, onboarding, index diagnostics ) may keep `$state` on the root `App.svelte` instead of a separate AppState module when the surface is a single form / flow. Related: ["../extension/workspace-summary/ideas_summary/webview.rq".table_column_filters] `$derived` binding rule; ["../extension/workspace-summary/ideas_summary/graphical_graph.rq".graph_ui_persistence]. | 0.070 | |
| graph_loading | the extension pushes graphSlice when the index is ready — no empty waitingForIndex wedge. ["../../../../packages/extension/src/ideas_summary_module/ideas-summary-panel.ts"] sets graphSlicePending on loadGraph and delivers the slice when the index becomes ready ( including via index status updates ). Index status posts must not await graph slice builds, so sync progress keeps updating the Index tab. webview state in ["../../../../packages/extension/webviews/ideas-summary/state/app.svelte.ts"] is query, slice, loading, rendering, and error only. App. init attaches the window message listener during App. svelte script setup ( before child onMount ) so loadGraph replies are never dropped. GraphView marks a slice as synced only in onRendered ( after cytoscape flush + layout ), not before syncSlice is queued. Webview → extension posts go through ["../../../../packages/extension/webviews/ideas-summary/lib/vscode.ts"] which JSON-clones payloads so Svelte $ state proxies are structured-clone safe. GraphView remount reuses app. graph. slice when present; it only loadGraphs when there is no slice and nothing in flight, or force-retries after an error. GraphView mounts only while the graph tab is active ( see TabPanels ); per [graph_cy_controller] do not keep cytoscape alive under display: none. | 0.045 | ||
| 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/webviews/ideas-summary/state/app.svelte.ts", "../../packages/extension/webviews/ideas-summary/state/app.svelte.ts", ../../../../packages/extension/webviews/ideas-summary/state/app.svelte.ts, ../../packages/extension/webviews/ideas-summary/state/app.svelte.ts