Skip to content

Commit 81161d9

Browse files
committed
switch to ratatui core
1 parent 0e30808 commit 81161d9

File tree

8 files changed

+26
-21
lines changed

8 files changed

+26
-21
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ readme = "README.md"
1010
license = "MIT"
1111

1212
[dependencies]
13-
ratatui = { version = "0.30", default-features = false }
13+
ratatui-core = { package = "ratatui-core", version = "0.1" }
14+
ratatui-widgets = { version = "0.3.0", default-features = false }
1415

1516
[dev-dependencies]
1617
ratatui = { version = "0.30", features = ["crossterm"] }

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66

77
</div>
88

9-
This crate provides a stateful widget [`ListView`] implementation for `Ratatui`. The associated [`ListState`], offers functionalities such as navigating to the next and previous items.
9+
This crate provides a stateful widget [`ListView`] implementation for `Ratatui`.
10+
The associated [`ListState`], offers functionalities such as navigating to the next and previous items.
1011
The list view support both horizontal and vertical scrolling.
1112

1213
### Configuration
1314
The [`ListView`] can be customized with the following options:
1415
- [`ListView::scroll_axis`]: Specifies whether the list is vertically or horizontally scrollable.
15-
16-
- [`ListView::scroll_padding`]: Specifies whether content should remain visible while scrolling, ensuring that a specified amount of padding is preserved above/below the selected item during scrolling.
16+
- [`ListView::scroll_padding`]: Specifies whether content should remain visible while scrolling, ensuring that a
17+
specified amount of padding is preserved above/below the selected item during scrolling.
1718
- [`ListView::infinite_scrolling`]: Allows the list to wrap around when scrolling past the first or last element.
1819
- [`ListView::style`]: Defines the base style of the list.
1920
- [`ListView::block`]: Optional outer block surrounding the list.

src/legacy/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(deprecated)]
2-
use ratatui::widgets::Widget;
2+
use ratatui_core::widgets::Widget;
33

44
use crate::ScrollAxis;
55

src/legacy/widget.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#![allow(clippy::cast_possible_truncation, deprecated)]
2-
use ratatui::{
3-
prelude::{Buffer, Rect},
2+
use ratatui_core::{
3+
buffer::Buffer,
4+
layout::Rect,
45
style::{Style, Styled},
5-
widgets::{Block, StatefulWidget, Widget},
6+
widgets::{StatefulWidget, Widget},
67
};
8+
use ratatui_widgets::block::Block;
79

810
use crate::{legacy::utils::layout_on_viewport, ListState, PreRender, ScrollAxis};
911

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
//!
77
//! </div>
88
//!
9-
//! This crate provides a stateful widget [`ListView`] implementation for `Ratatui`. The associated [`ListState`], offers functionalities such as navigating to the next and previous items.
9+
//! This crate provides a stateful widget [`ListView`] implementation for `Ratatui`.
10+
//! The associated [`ListState`], offers functionalities such as navigating to the next and previous items.
1011
//! The list view support both horizontal and vertical scrolling.
1112
//!
1213
//! ## Configuration
1314
//! The [`ListView`] can be customized with the following options:
1415
//! - [`ListView::scroll_axis`]: Specifies whether the list is vertically or horizontally scrollable.
15-
//!
16-
//! - [`ListView::scroll_padding`]: Specifies whether content should remain visible while scrolling, ensuring that a specified amount of padding is preserved above/below the selected item during scrolling.
16+
//! - [`ListView::scroll_padding`]: Specifies whether content should remain visible while scrolling, ensuring that a
17+
//! specified amount of padding is preserved above/below the selected item during scrolling.
1718
//! - [`ListView::infinite_scrolling`]: Allows the list to wrap around when scrolling past the first or last element.
1819
//! - [`ListView::style`]: Defines the base style of the list.
1920
//! - [`ListView::block`]: Optional outer block surrounding the list.

src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use ratatui::widgets::ScrollbarState;
1+
use ratatui_widgets::scrollbar::ScrollbarState;
22

33
use crate::{ListBuildContext, ListBuilder, ScrollAxis};
44

src/utils.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -480,14 +480,11 @@ impl<T> ViewportElement<T> {
480480

481481
#[cfg(test)]
482482
mod tests {
483-
use ratatui::{
484-
prelude::*,
485-
widgets::{Block, Borders},
486-
};
487-
488-
use crate::state::ViewState;
489-
490483
use super::*;
484+
use crate::state::ViewState;
485+
use ratatui_core::{buffer::Buffer, layout::Rect, widgets::Widget};
486+
use ratatui_widgets::block::Block;
487+
use ratatui_widgets::borders::Borders;
491488

492489
#[derive(Debug, Default, PartialEq, Eq)]
493490
struct TestItem {}

src/view.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
use ratatui::{
1+
use ratatui_core::{
22
buffer::Buffer,
33
layout::{Position, Rect},
44
style::{Style, Styled},
5-
widgets::{Block, BlockExt as _, Scrollbar, StatefulWidget, Widget},
5+
widgets::{StatefulWidget, Widget},
66
};
7+
use ratatui_widgets::block::Block;
8+
use ratatui_widgets::block::BlockExt;
9+
use ratatui_widgets::scrollbar::Scrollbar;
710

811
use crate::{utils::layout_on_viewport, ListState};
912

0 commit comments

Comments
 (0)