Skip to main content

@ai-coach/vault-view-feat-graph

Interactive vault link graph, filter sidebar, note reader, and progressive distillation feature for the vault view. It is lazy-loaded at / and wires GraphStore state to the SVG force canvas, detail views, and focus-mode distillation editor.

What it does not do​

  • No direct HTTP calls or raw backend imports. All API calls and state live in @ai-coach/vault-view-data-access; @nx/enforce-module-boundaries restricts type:feat to type:ui, type:data-access, type:util, and scope:shared.
  • No sibling feature imports. Feature libraries (feat-graph, feat-plans, feat-climb) never import each other.
  • No leaked internal sub-components. Only GraphFeatureComponent is exported from src/index.ts; all smart and composite sub-components stay private to this library.

Architecture fit​

[apps/vault-view route '/']
│
▼
[GraphFeatureComponent] ──provides──▶ [provideGraphStores()]
│ │ │
▼ ▼ ▼
[Canvas] [Filters] [Detail views & Focus reader] ──▶ [@ai-coach/vault-view-ui]

Internal architecture & rules​

  • Typed component folders & suffixes (DEC-AIC-0063): The route entry lives directly at src/lib/graph.component.ts (GraphFeatureComponent, vault-graph-feature); stateful smart components live under src/lib/smart/<name>/ (*SmartComponent, vault-*-smart: graph-canvas/, graph-filters/, graph-detail-panel/, focus-reader/, passage-editor/, note-reader/); pure input()/output() domain composites live under src/lib/composite/<name>/ (*CompositeComponent: graph-canvas-controls/, graph-page-detail/, graph-book-detail/, graph-chapter-detail/, graph-note-detail/, graph-overview-detail/, note-blocks/, summary-editor/).
  • Separated canvas concerns: graph-canvas/ splits pure SVG scene builders (graph-canvas-scene.ts), camera/pointer navigation (graph-camera.controller.ts), and floating controls (graph-canvas-controls/) from GraphCanvasSmartComponent.
  • Focused detail views: GraphDetailPanelSmartComponent delegates rendering to five pure input()/output() composite views (Page, Book, Chapter, Note, Overview) composed from @ai-coach/vault-view-ui atoms and molecules.
  • Component standards (DEC-AIC-0062): ChangeDetectionStrategy.OnPush everywhere, external .html/.css files for templates over ~40 lines, explicit public/private member accessibility, and zero comments in source code (DEC-AIC-0011).

Public surface​

  • GraphFeatureComponent (vault-graph-feature) — Root route feature component providing provideGraphStores() and coordinating keyboard shortcuts, canvas framing, filters, detail views, and focus distillation.

How to extend it​

  1. Add any new state or API methods to the matching store in @ai-coach/vault-view-data-access and pure layout/formatting helpers to @ai-coach/vault-view-util.
  2. Create a private OnPush component in src/lib/smart/<name>/ (*SmartComponent if injecting a store) or src/lib/composite/<name>/ (*CompositeComponent if purely input()/output()) using atoms and molecules from @ai-coach/vault-view-ui.
  3. Wire the new component into GraphFeatureComponent or GraphDetailPanelSmartComponent without exporting it from src/index.ts.
  4. Run npm exec nx lint @ai-coach/vault-view-feat-graph, npm exec nx typecheck @ai-coach/vault-view-feat-graph, and npm exec nx test @ai-coach/vault-view-feat-graph.

Running & testing​

Unit tests run in Vitest; ngc verifies all external templates and strict signal bindings.

npm exec nx test @ai-coach/vault-view-feat-graph
npm exec nx lint @ai-coach/vault-view-feat-graph
npm exec nx typecheck @ai-coach/vault-view-feat-graph

Key ADRs​

  • DEC-AIC-0059 — Establishes the Angular layered frontend and feature library split for the vault view.
  • DEC-AIC-0062 — Codifies smart container responsibilities, OnPush, external templates/styles, and Nx guardrails.
  • DEC-AIC-0063 — Adopts feature, smart, and composite component suffixes and directory rules.
  • DEC-AIC-0051 — Defines workspace tags and @nx/enforce-module-boundaries constraints.
  • DEC-AIC-0060 — Governs the eight-section package README structure and Docusaurus ingestion.