Skip to content

kubeui spike: small quadraui API friction worth fixing #224

Description

@JDonaghy

Captured during the kubeui validation spike (#145, landed at `1cbc98b`). None of these are blockers; collecting them so they're not lost. Best tackled alongside #223.

1. `StatusBarSegment` has no width hint

Today the struct is `{ text, fg, bg, bold, action_id }` and rasterisers compute `text.chars().count()` (TUI cells) or `pango_layout.pixel_size()` (GTK pixels) themselves at paint time. `StatusBar::resolve_click(col, bar_width)` works in cell units, so GTK callers have to convert pixel-x → cell-col before calling it (and that only works because we're using a monospace font).

Suggested: mirror the `width_cells: usize` field that lives on the demo's `StatusSegment` (and seems to have been the original shape). Or, parameterise `resolve_click` over a measurer the way `fit_right_start` already is.

2. `StyledSpan` `underline: bool` field is rarely populated

Every constructor site has to write `underline: false` even though essentially all callers don't underline. Either default it via `Default` impl or via a builder helper:

```rust
let span = StyledSpan::plain("hello").bold();
```

Halves the verbosity of every primitive builder.

3. Picker primitive: title with embedded query is awkward

Today the kubeui picker shows the filter query by formatting it into the title: `" Namespace — abc"`. `quadraui::Palette` has a proper query-input row but `ListView` doesn't, and `bordered: true` is the modal-style we want. Either:

  • Add an optional `query: Option` field to `ListView` (rendered between title and items in bordered mode), or
  • Migrate kubeui's picker to `Palette` once Palette gains the bordered-modal styling.

4. `picker_bounds` should live in quadraui, not the consumer

`kubeui-core::view::picker_bounds(picker, viewport, cell_w, cell_h) -> Rect` is an obvious quadraui-level helper — every modal-list-overlay consumer wants the same "centred, sized to content, clamped to viewport" computation. Lives in kubeui only because there was no obvious home for it in quadraui today.

Suggested: `ListView::modal_bounds(viewport, measure) -> Rect` on bordered ListViews.

5. No "click-outside-modal" helper in click dispatch

Both kubeui binaries reimplement "if the picker is open, dismiss when click is outside its bounds." vimcode's `quadraui::ModalStack` solves this for vimcode-internal code paths, but external apps don't get it because the dispatch helpers (`dispatch_mouse_down`) aren't tied to anything they own.

Suggested: wrap the same logic in a primitive-level helper:

```rust
let dismiss = list.modal_click_intent(point); // Some(Inside(idx)) | Some(Outside) | None
```

Rough effort

Each of (1) (2) (3) (4) is a few-hour quadraui change. (5) is probably half a day with tests. All five together, ~1 session of focused work — best done after (or as part of) #223 since the rasterisers will move anyway.

Surfaced by

The kubeui validation spike. See the kubeui-core view-builders + the per-backend draw_picker / click_to_actions for concrete examples of each pain point.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions