2026-10-17 12:08:30 -05:00
|
|
|
|
//! TUI widgets and shared styling for UI components.
|
|
|
|
|
|
|
|
|
|
|
|
mod activity;
|
|
|
|
|
|
mod backdrop;
|
|
|
|
|
|
mod card;
|
|
|
|
|
|
mod cells;
|
|
|
|
|
|
mod fit;
|
|
|
|
|
|
mod gauge;
|
|
|
|
|
|
mod language_glyph;
|
|
|
|
|
|
mod panel;
|
|
|
|
|
|
mod scrollbar;
|
|
|
|
|
|
mod slab;
|
|
|
|
|
|
pub(crate) mod text_field;
|
|
|
|
|
|
mod tool_glyph;
|
|
|
|
|
|
mod wordmark;
|
|
|
|
|
|
mod wrap;
|
|
|
|
|
|
|
|
|
|
|
|
pub use activity::{activity_bar, ActivityGlyphs};
|
|
|
|
|
|
pub use backdrop::dim_backdrop;
|
|
|
|
|
|
pub use card::{card, card_inner_width};
|
|
|
|
|
|
pub(crate) use fit::{elide_path_components, truncate_middle};
|
|
|
|
|
|
pub use fit::{truncate_end, truncate_start};
|
|
|
|
|
|
pub use gauge::fill_gauge;
|
|
|
|
|
|
pub use language_glyph::{language_hue, language_icon, GENERIC_LANGUAGE};
|
|
|
|
|
|
pub use panel::{
|
|
|
|
|
|
code_spans, footed_body, key_hint, key_hint_row, panel_block, panel_title, panel_title_width,
|
|
|
|
|
|
render_footed, render_footer, split_footer, titled_panel, FOOTER_ROWS, PANEL_BORDER_TYPE,
|
|
|
|
|
|
};
|
|
|
|
|
|
pub use scrollbar::{drag_offset, scrollbar, steered_scrollbar};
|
|
|
|
|
|
pub use slab::{
|
|
|
|
|
|
badge, fade, idle_badge, ramp, selection_block, selection_row, selection_row_on, slab, Cap,
|
|
|
|
|
|
Fade, FADE_CELLS, SELECTION_FRAME, SELECTION_INSET, SLAB_FRAME,
|
|
|
|
|
|
};
|
|
|
|
|
|
pub use tool_glyph::{tool_glyph, tool_icon, GENERIC_TOOL};
|
|
|
|
|
|
pub use wordmark::{
|
|
|
|
|
|
banner_frame_due, render_wordmark, smoothstep, BannerClock, Wordmark, WordmarkInk, BAND,
|
The README opens on the animated wordmark, says how Luxe is built, and CONTRIBUTING asks contributors to disclose AI help
- The README's wordmark is an animated GIF with a transparent background, rendered from the
dashboard's own art and lights, in light and dark variants for GitHub's two themes.
- The README says Luxe is built with AI assistance, much of it Luxe working on itself, and
CONTRIBUTING has an AI-assistance section: say what helped, understand the change, write to
people in your own words.
- The redaction table's Google-key example is joined at compile time, so secret scanning stops
reading the invented value as a leaked key.
- The MCP trust tests read Luxe's own report of what it started, so a slow runner can neither fail
them nor pass them falsely.
2026-10-17 22:09:56 -05:00
|
|
|
|
DRIFT_DEPTH, DRIFT_FRAME_TICKS, DRIFT_PERIOD_TICKS, LEAN, PEAK_DARK, PEAK_LIGHT,
|
|
|
|
|
|
SHINE_CYCLE_TICKS, SHINE_SWEEP_TICKS, STILL_TICK,
|
2026-10-17 12:08:30 -05:00
|
|
|
|
};
|
|
|
|
|
|
pub use wrap::{wrap_cells, wrap_line, wrap_lines, wrapped_row_starts};
|
|
|
|
|
|
|
|
|
|
|
|
use ratatui::layout::Rect;
|
|
|
|
|
|
|
|
|
|
|
|
/// The fewest rows a preview can be drawn in: its border, its footer, and one line of what it says.
|
|
|
|
|
|
pub(crate) const PREVIEW_MIN_ROWS: u16 = 2 + FOOTER_ROWS + 1;
|
|
|
|
|
|
|
|
|
|
|
|
/// Where a review preview `width` × `rows` sits in `area`, a row clear above and below; or, when
|
|
|
|
|
|
/// not even [`PREVIEW_MIN_ROWS`] fit, `None` with a bounded notice drawn in its place.
|
|
|
|
|
|
///
|
|
|
|
|
|
/// `min_rows` is a preference, raised to where there is room and lowered to fit where there is
|
|
|
|
|
|
/// not. The review records which happened, because a preview its notice stands in for must take
|
|
|
|
|
|
/// no key but esc: a confirm the reader cannot see is not one.
|
|
|
|
|
|
pub(crate) fn fit_review_preview(
|
|
|
|
|
|
frame: &mut ratatui::Frame,
|
|
|
|
|
|
area: Rect,
|
|
|
|
|
|
(width, rows, min_rows): (u16, u16, u16),
|
|
|
|
|
|
app: &crate::app::App,
|
|
|
|
|
|
) -> Option<Rect> {
|
|
|
|
|
|
let fit = fit_preview(frame, area, (width, rows, min_rows), false, &app.theme_styles);
|
|
|
|
|
|
app.guided_review_workspace.settle_preview(fit.is_some());
|
|
|
|
|
|
fit
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// [`fit_review_preview`] for a dialog whose rows are all choices: it is drawn whole or not at
|
|
|
|
|
|
/// all, since a card cut short hides options the keys still act on.
|
|
|
|
|
|
pub(crate) fn fit_whole_review_preview(
|
|
|
|
|
|
frame: &mut ratatui::Frame,
|
|
|
|
|
|
area: Rect,
|
|
|
|
|
|
(width, rows): (u16, u16),
|
|
|
|
|
|
app: &crate::app::App,
|
|
|
|
|
|
) -> Option<Rect> {
|
|
|
|
|
|
let fit = fit_preview(frame, area, (width, rows, rows), true, &app.theme_styles);
|
|
|
|
|
|
app.guided_review_workspace.settle_preview(fit.is_some());
|
|
|
|
|
|
fit
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// [`fit_review_preview`]'s layout and notice, without the review's guard.
|
|
|
|
|
|
fn fit_preview(
|
|
|
|
|
|
frame: &mut ratatui::Frame,
|
|
|
|
|
|
area: Rect,
|
|
|
|
|
|
(width, rows, min_rows): (u16, u16, u16),
|
|
|
|
|
|
whole: bool,
|
|
|
|
|
|
styles: &crate::theme::styles::ThemeStyles,
|
|
|
|
|
|
) -> Option<Rect> {
|
|
|
|
|
|
let room = area.height.saturating_sub(2);
|
|
|
|
|
|
if room >= PREVIEW_MIN_ROWS && !(whole && rows > room) {
|
|
|
|
|
|
return Some(centered_rect(width, rows.max(min_rows).min(room), area));
|
|
|
|
|
|
}
|
|
|
|
|
|
use ratatui::text::{Line, Span};
|
|
|
|
|
|
let notice = centered_rect(40, 2, area);
|
|
|
|
|
|
frame.render_widget(ratatui::widgets::Clear, notice);
|
|
|
|
|
|
frame.render_widget(
|
|
|
|
|
|
ratatui::widgets::Paragraph::new(vec![
|
|
|
|
|
|
Line::from(Span::styled("Make the window bigger to see this", styles.error)),
|
|
|
|
|
|
Line::from(Span::styled("Only esc acts until it fits", styles.muted)),
|
|
|
|
|
|
])
|
|
|
|
|
|
.alignment(ratatui::layout::Alignment::Center),
|
|
|
|
|
|
notice,
|
|
|
|
|
|
);
|
|
|
|
|
|
None
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// A `width` × `height` box in the middle of `area`, clamped to it.
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Every centered surface measures its content and then asks for this, so "in the middle" means the
|
|
|
|
|
|
/// same thing on the dashboard, the Configuration surface, and anything that joins them.
|
|
|
|
|
|
pub fn centered_rect(width: u16, height: u16, area: Rect) -> Rect {
|
|
|
|
|
|
let width = width.min(area.width);
|
|
|
|
|
|
let height = height.min(area.height);
|
|
|
|
|
|
Rect::new(
|
|
|
|
|
|
area.x + area.width.saturating_sub(width) / 2,
|
|
|
|
|
|
area.y + area.height.saturating_sub(height) / 2,
|
|
|
|
|
|
width,
|
|
|
|
|
|
height,
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|