Skip to main content

frankensearch_tui/
lib.rs

1//! Shared TUI framework for frankensearch products.
2//!
3//! This crate provides reusable terminal UI primitives shared by both the
4//! fsfs deluxe TUI and the ops observability TUI. It ensures consistent UX,
5//! keyboard shortcuts, theming, and accessibility across all frankensearch
6//! TUI products.
7//!
8//! # Architecture
9//!
10//! ```text
11//! ┌─────────────────────────────────────────────────┐
12//! │  Product crates (fsfs, ops)                     │
13//! │  └─ product-specific screens + data sources     │
14//! ├─────────────────────────────────────────────────┤
15//! │  frankensearch-tui (this crate)                 │
16//! │  ├─ screen: Screen trait, ScreenId, registry    │
17//! │  ├─ shell: App shell, status bar, breadcrumbs   │
18//! │  ├─ palette: Command palette, action routing    │
19//! │  ├─ input: Keymap, bindings, mouse model        │
20//! │  ├─ theme: Color schemes, dark/light presets    │
21//! │  ├─ overlay: Help, alerts, confirmation dialogs │
22//! │  ├─ accessibility: Focus, semantic annotations  │
23//! │  ├─ frame: Budget enforcement, jank detection   │
24//! │  ├─ replay: Input recording, deterministic play │
25//! │  ├─ determinism: Clock trait, seeds, replay ctx  │
26//! │  ├─ evidence: JSONL evidence hooks + redaction   │
27//! │  └─ terminal: Mode detection, reconnect handler │
28//! ├─────────────────────────────────────────────────┤
29//! │  FrankenTUI (ftui-*)                             │
30//! └─────────────────────────────────────────────────┘
31//! ```
32//!
33//! # Usage
34//!
35//! Product crates implement the [`Screen`] trait for their views, register
36//! them in a [`ScreenRegistry`], and hand control to the [`AppShell`] which
37//! manages navigation, overlays, input dispatch, and frame timing.
38
39#![forbid(unsafe_code)]
40
41pub mod accessibility;
42pub mod determinism;
43pub mod evidence;
44pub mod frame;
45pub mod input;
46pub mod interaction;
47pub mod overlay;
48pub mod palette;
49pub mod replay;
50pub mod screen;
51pub mod shell;
52pub mod terminal;
53pub mod theme;
54
55// ─── Re-exports ─────────────────────────────────────────────────────────────
56
57pub use accessibility::{FocusDirection, FocusManager, SemanticRole};
58pub use determinism::{Clock, DeterministicSeed, ReplayMetadata, ReplayMode, TickClock, WallClock};
59pub use evidence::{
60    EvidenceEnvelope, EvidenceEvent, EvidenceEventType, EvidencePayload, EvidenceReason,
61    EvidenceRedaction, EvidenceSeverity, EvidenceSink, EvidenceTrace, EvidenceWriteError,
62    NoopWriter, RedactionTransform, VecWriter,
63};
64pub use frame::{
65    CachedLayout, CachedTabState, FrameBudget, FrameMetrics, FramePipelineMetrics,
66    FramePipelineTimer, JankCallback,
67};
68pub use input::{InputEvent, KeyAction, KeyBinding, Keymap};
69pub use interaction::{
70    CardLayoutRule, CardRole, DeterministicCheckpoint, DeterministicStateBoundary,
71    InteractionLatencyHooks, InteractionSurfaceContract, InteractionSurfaceKind, LayoutAxis,
72    PaletteIntent, PaletteIntentRoute, SHOWCASE_INTERACTION_SPEC_VERSION, ShowcaseInteractionSpec,
73    ShowcaseInteractionSpecError,
74};
75pub use overlay::{OverlayKind, OverlayManager, OverlayRequest};
76pub use palette::{Action, ActionCategory, CommandPalette, PaletteState};
77pub use replay::{InputRecord, ReplayPlayer, ReplayRecorder, ReplayState};
78pub use screen::{Screen, ScreenContext, ScreenId, ScreenRegistry};
79pub use shell::{AppShell, ShellConfig, StatusLine};
80pub use terminal::{TerminalEvent, TerminalMode, TerminalState};
81pub use theme::{ColorScheme, Theme, ThemePreset};