build: migrate to tui-realm 4.0#418
Merged
Merged
Conversation
Upgrade tuirealm (3.x -> 4.0.0), tui-realm-stdlib (3 -> 4), tui-term (0.2 -> 0.3). Apply all breaking changes from the 4.0 migration guide across the termscp UI. Key changes: - Root-level re-exports removed; imports moved to module-qualified paths (`tuirealm::application`, `::component`, `::event`, `::props`, `::state`, `::subscription`, `::listener`, `::ratatui`). Same for stdlib component types (`tui_realm_stdlib::components::*`). - `MockComponent` trait renamed to `Component`; old `Component` trait renamed to `AppComponent`. `#[derive(MockComponent)]` is now `#[derive(Component)]`. `Component::on` now takes `&Event<_>`. - `TextSpan` replaced with `SpanStatic`/`LineStatic`/`TextStatic` (ratatui-based); tuple `(String, Alignment)` titles replaced with the new `Title` builder; `Alignment` split into `HorizontalAlignment`/`VerticalAlignment`; stdlib components use `.alignment_horizontal` instead of `.alignment`. - `State::One`/`PropPayload::One` -> `Single`. `CmdResult::None` -> `NoChange`. `Props::get_or` removed; `Props::get` now returns a borrowed `Option<&AttrValue>` (call sites switched to `.and_then(AttrValue::as_*)`). `Component::query` returns `Option<QueryResult<'a>>`. - `Attribute::HighlightedColor` -> `HighlightStyle` (a full `Style`). `.highlighted_*` helpers renamed to `.highlight_*`. - `PollStrategy::UpTo(n)` now requires a `Duration`; tick timeout moved from `EventListenerCfg::poll_timeout` into `PollStrategy`. - `TerminalBridge` removed; `Context` now holds `CrosstermTerminalAdapter` directly and enables raw mode + alternate screen explicitly. The `TerminalAdapter` trait is imported where its methods are used. - `Update` trait removed; activity `update` methods are plain inherent functions. - `ProgressBar` replaced by stdlib `Gauge`. Paragraph `.wrap` renamed to `.wrap_trim`; `.text` now takes an `Into<Text>`. Stdlib `List` row items are now individual lines (`Vec<Span>` per row) rather than a `Table` of spans; custom `FileList`/`Log` convert between the two models. - Radio builders drop `.foreground(color)` so unselected items render with the terminal default foreground, and set `highlight_style(Style::default().fg(color).add_modifier(REVERSED))` so the selected entry is visibly highlighted only with the theme color. - Custom `FileList` keeps the selected row highlighted with the full highlight style when focused and falls back to a foreground-only style when unfocused. - Theme loading is now backwards compatible: `Theme` uses a custom `Deserialize` through an intermediate `ThemeFile` with optional fields, so missing keys, unknown values or legacy aliases (`transfer_progress_bar_full`/`_partial`) fall back to defaults on a per-field basis instead of failing the whole load.
|
✔️ 7fde801 - Conventional commits check succeeded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tuirealm(3.x → 4.0),tui-realm-stdlib(3 → 4) andtui-term(0.2 → 0.3)Themedeserialization backwards compatible so pre-existing theme files keep workingMigration highlights
tuirealm::application,component,event,props,state,subscription,listener,ratatui;tui_realm_stdlib::components::*)MockComponent→Component; oldComponenttrait →AppComponent;fn onnow takes&Event<_>;#[derive(Component)]replaces#[derive(MockComponent)]TextSpan→SpanStatic/LineStatic/TextStatic;(String, Alignment)titles →Titlebuilder;Alignmentsplit intoHorizontalAlignment/VerticalAlignment; stdlib components use.alignment_horizontalState::One/PropPayload::One→Single;CmdResult::None→NoChange;Props::get_orremoved andProps::getnow borrows;Component::queryreturnsOption<QueryResult<'a>>Attribute::HighlightedColor→HighlightStyle(fullStyle);.highlighted_*helpers →.highlight_*PollStrategy::UpTo(n)now requires aDuration; tick timeout moved fromEventListenerCfg::poll_timeoutintoPollStrategyTerminalBridgeremoved →Contextnow owns aCrosstermTerminalAdapterdirectlyUpdatetrait removed → activityupdatemethods are plain inherent functionsProgressBar→Gauge; Paragraph.wrap→.wrap_trim;.textnow takesInto<Text>; stdlibListrows areVec<Span>per row (customFileList/Logconvert between the oldTablemodel and the new one)UX fixes needed after the migration
.foreground(color)so unselected entries use the terminal default foreground, and sethighlight_style(Style::default().fg(color).add_modifier(REVERSED))so only the selected entry is coloredFileListkeeps the full highlight style on the selected row when focused, and falls back to a foreground-only style when unfocused.inactiveoverride), keeping the unfocused fg at terminal defaultTheme backwards compatibility
Themenow uses a customDeserializethrough an intermediateThemeFilewith optional string fields. Missing fields, unknown values or legacy aliases (transfer_progress_bar_full/_partial) fall back to defaults on a per-field basis instead of failing the whole theme load. Covered by new tests insrc/config/themes.rsand an updated expectation insrc/config/serialization.rs.Test plan
cargo build --no-default-featurescargo clippy --no-default-features -- -Dwarningscargo +nightly fmt --all -- --checkcargo test --no-default-features --features github-actions --no-fail-fasttransfer_progress_bar_*or malformed colors) still loads and applies saved colors