feat: show relationship <name> renders a styled two-table diagram (ADR-0044)
The first wired slice of relationship visualization (V1). `show relationship <name>` now renders the relationship as two full structure boxes joined by a width-jogging connector (child-left / parent-right, n…1 cardinality, on delete/update actions), styled App-side, with a vertical-stack fallback for narrow terminals. - db.rs: RelationshipDiagramData + show_relationship worker path (structured data: the relationship + both endpoint TableDescriptions) - runtime.rs: named relationships route to the structured outcome (boxed); other show <kind> forms stay prose - app.rs/event.rs/ui.rs: DslShowRelationshipSucceeded rendered App-side; new diagram OutputStyleClass variants; App::last_output_width from ui.rs - output_render.rs: styled Seg layout engine (boxes, connector routing, side-by-side + vertical), composing the ADR-0016 box primitives Tests: 4 unit + 4 integration; full suite 2201 pass / 0 fail / 1 ignored; clippy nursery clean. requirements.md V1 stays [/] (show table diagrams, compound routing, DDL-echo wiring remain).
This commit is contained in:
@@ -667,6 +667,9 @@ fn render_output_panel(app: &mut App, theme: &Theme, frame: &mut Frame<'_>, area
|
||||
// mutable `note_output_viewport` call below).
|
||||
let total_wrapped = approximate_wrapped_rows_from_output(&app.output, inner.width);
|
||||
app.note_output_viewport(visible, total_wrapped);
|
||||
// ADR-0044 §3: record the panel width so a later `show relationship`
|
||||
// diagram (rendered App-side) can choose side-by-side vs vertical.
|
||||
app.last_output_width = inner.width;
|
||||
|
||||
let lines: Vec<Line<'_>> = app
|
||||
.output
|
||||
@@ -756,6 +759,19 @@ const fn output_span_style(class: OutputStyleClass, theme: &Theme) -> Style {
|
||||
// existing `client_side.*` notes). `theme.muted` is the
|
||||
// established dim foreground.
|
||||
OutputStyleClass::Hint => Style::new().fg(theme.muted),
|
||||
// ADR-0044 relationship diagrams. Reuse existing theme colours
|
||||
// (no new Theme fields): the table name stands out via weight,
|
||||
// keys + cardinality take accent colours, connectors are muted.
|
||||
OutputStyleClass::DiagramTableName => {
|
||||
Style::new().fg(theme.fg).add_modifier(Modifier::BOLD)
|
||||
}
|
||||
OutputStyleClass::DiagramKey => Style::new()
|
||||
.fg(theme.plan_efficient)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
OutputStyleClass::DiagramCardinality => Style::new()
|
||||
.fg(theme.tok_number)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
OutputStyleClass::DiagramConnector => Style::new().fg(theme.muted),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user