refactor: switch to ratatui-core (#4050)

This commit is contained in:
三咲雅 misaki masa 2026-06-18 16:18:01 +08:00 committed by sxyazi
parent 446a5721bf
commit 53d36b5186
No known key found for this signature in database
101 changed files with 566 additions and 1203 deletions

936
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -62,7 +62,8 @@ parking_lot = "0.12.5"
paste = "1.0.15" paste = "1.0.15"
percent-encoding = "2.3.2" percent-encoding = "2.3.2"
rand = { version = "0.10.1", default-features = false, features = [ "std", "sys_rng" ] } rand = { version = "0.10.1", default-features = false, features = [ "std", "sys_rng" ] }
ratatui = { version = "0.30.1", default-features = false, features = [ "std", "layout-cache", "serde", "underline-color", "unstable-rendered-line-info", "unstable-widget-ref" ] } ratatui-core = { version = "0.1.1", default-features = false, features = [ "std", "layout-cache", "serde", "underline-color" ] }
ratatui-widgets = { version = "0.3.1", default-features = false, features = [ "std", "unstable-rendered-line-info" ] }
regex = "1.12.4" regex = "1.12.4"
russh = { version = "0.61.2", default-features = false, features = [ "ring", "rsa" ] } russh = { version = "0.61.2", default-features = false, features = [ "ring", "rsa" ] }
scopeguard = "1.2.0" scopeguard = "1.2.0"
@ -94,6 +95,5 @@ unit_arg = "allow"
use_self = "warn" use_self = "warn"
[patch.crates-io] [patch.crates-io]
ratatui = { git = "https://github.com/yazi-rs/ratatui.git", package = "ratatui", rev = "a1c4922a242861d755163ae85d7e41b85ed277d2" }
ratatui-core = { git = "https://github.com/yazi-rs/ratatui.git", package = "ratatui-core", rev = "a1c4922a242861d755163ae85d7e41b85ed277d2" } ratatui-core = { git = "https://github.com/yazi-rs/ratatui.git", package = "ratatui-core", rev = "a1c4922a242861d755163ae85d7e41b85ed277d2" }
ratatui-widgets = { git = "https://github.com/yazi-rs/ratatui.git", package = "ratatui-widgets", rev = "a1c4922a242861d755163ae85d7e41b85ed277d2" } ratatui-widgets = { git = "https://github.com/yazi-rs/ratatui.git", package = "ratatui-widgets", rev = "a1c4922a242861d755163ae85d7e41b85ed277d2" }

View file

@ -29,7 +29,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoLock = { cargoLock = {
lockFile = "${src}/Cargo.lock"; lockFile = "${src}/Cargo.lock";
outputHashes = { outputHashes = {
"ratatui-0.30.1" = "sha256-wkEOgwAhW0ObtPDlJmOOoY5qf9c/P79ktN4b43jtcGw="; "ratatui-core-0.1.1" = "sha256-wkEOgwAhW0ObtPDlJmOOoY5qf9c/P79ktN4b43jtcGw=";
"ratatui-widgets-0.3.1" = "sha256-wkEOgwAhW0ObtPDlJmOOoY5qf9c/P79ktN4b43jtcGw=";
}; };
}; };

View file

@ -40,19 +40,20 @@ yazi-watcher = { path = "../yazi-watcher", version = "26.5.6" }
yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" } yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }
either = { workspace = true } either = { workspace = true }
futures = { workspace = true } futures = { workspace = true }
hashbrown = { workspace = true } hashbrown = { workspace = true }
indexmap = { workspace = true } indexmap = { workspace = true }
mlua = { workspace = true } mlua = { workspace = true }
parking_lot = { workspace = true } parking_lot = { workspace = true }
paste = { workspace = true } paste = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
scopeguard = { workspace = true } ratatui-widgets = { workspace = true }
tokio = { workspace = true } scopeguard = { workspace = true }
tokio-stream = { workspace = true } tokio = { workspace = true }
tracing = { workspace = true } tokio-stream = { workspace = true }
tracing = { workspace = true }
[target."cfg(unix)".dependencies] [target."cfg(unix)".dependencies]
libc = { workspace = true } libc = { workspace = true }

View file

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use mlua::Value; use mlua::Value;
use ratatui::layout::Position; use ratatui_core::layout::Position;
use tracing::error; use tracing::error;
use yazi_actor::lives::Lives; use yazi_actor::lives::Lives;
use yazi_config::LAYOUT; use yazi_config::LAYOUT;

View file

@ -1,5 +1,5 @@
use anyhow::Result; use anyhow::Result;
use ratatui::widgets::Padding; use ratatui_widgets::block::Padding;
use yazi_config::{THEME, YAZI}; use yazi_config::{THEME, YAZI};
use yazi_macro::{act, render, succ}; use yazi_macro::{act, render, succ};
use yazi_parser::input::ShowForm; use yazi_parser::input::ShowForm;

View file

@ -1,7 +1,7 @@
use std::time::Duration; use std::time::Duration;
use anyhow::Result; use anyhow::Result;
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use yazi_core::notify::Notify; use yazi_core::notify::Notify;
use yazi_macro::{render, render_partial, succ}; use yazi_macro::{render, render_partial, succ};
use yazi_parser::notify::TickForm; use yazi_parser::notify::TickForm;

View file

@ -23,15 +23,15 @@ yazi-tty = { path = "../yazi-tty", version = "26.5.9" }
yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" } yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" }
# External dependencies # External dependencies
ansi-to-tui = { workspace = true } ansi-to-tui = { workspace = true }
anyhow = { workspace = true } anyhow = { workspace = true }
base64 = { workspace = true } base64 = { workspace = true }
image = { workspace = true } image = { workspace = true }
inventory = { workspace = true } inventory = { workspace = true }
moxcms = "0.8.1" moxcms = "0.8.1"
palette = { version = "0.7.6", default-features = false } palette = { version = "0.7.6", default-features = false }
quantette = { version = "0.6.0", default-features = false } quantette = { version = "0.6.0", default-features = false }
ratatui = { workspace = true } ratatui-core = { workspace = true }
strum = { workspace = true } strum = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }

View file

@ -1,7 +1,7 @@
use std::{fmt::{self, Debug}, ops::Deref}; use std::{fmt::{self, Debug}, ops::Deref};
use anyhow::Result; use anyhow::Result;
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use yazi_emulator::EMULATOR; use yazi_emulator::EMULATOR;
use yazi_shim::cell::SyncCell; use yazi_shim::cell::SyncCell;
use yazi_widgets::clear::ClearInventory; use yazi_widgets::clear::ClearInventory;

View file

@ -2,7 +2,7 @@ use std::{io::Write, path::PathBuf, process::Stdio};
use ansi_to_tui::IntoText; use ansi_to_tui::IntoText;
use anyhow::{Result, anyhow, bail}; use anyhow::{Result, anyhow, bail};
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use tokio::process::Command; use tokio::process::Command;
use yazi_config::THEME; use yazi_config::THEME;
use yazi_emulator::Emulator; use yazi_emulator::Emulator;

View file

@ -1,7 +1,7 @@
use std::path::PathBuf; use std::path::PathBuf;
use anyhow::Result; use anyhow::Result;
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use strum::{Display, IntoStaticStr}; use strum::{Display, IntoStaticStr};
use crate::drivers::{Chafa, Iip, Kgp, KgpOld, Sixel, Ueberzug}; use crate::drivers::{Chafa, Iip, Kgp, KgpOld, Sixel, Ueberzug};

View file

@ -3,7 +3,7 @@ use std::{fmt::Write as _, io::Write as _, path::PathBuf};
use anyhow::Result; use anyhow::Result;
use base64::{Engine, engine::{Config, general_purpose::STANDARD}}; use base64::{Engine, engine::{Config, general_purpose::STANDARD}};
use image::{DynamicImage, ExtendedColorType, ImageEncoder, codecs::{jpeg::JpegEncoder, png::PngEncoder}}; use image::{DynamicImage, ExtendedColorType, ImageEncoder, codecs::{jpeg::JpegEncoder, png::PngEncoder}};
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use yazi_config::{THEME, YAZI}; use yazi_config::{THEME, YAZI};
use yazi_emulator::{CLOSE, Emulator, START}; use yazi_emulator::{CLOSE, Emulator, START};
use yazi_tty::sequence::{MoveTo, ResetAttrs, SetBg}; use yazi_tty::sequence::{MoveTo, ResetAttrs, SetBg};

View file

@ -4,7 +4,7 @@ use std::{io::Write, path::PathBuf};
use anyhow::Result; use anyhow::Result;
use base64::{Engine, engine::general_purpose}; use base64::{Engine, engine::general_purpose};
use image::DynamicImage; use image::DynamicImage;
use ratatui::{layout::Rect, style::Color}; use ratatui_core::{layout::Rect, style::Color};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_emulator::{CLOSE, ESCAPE, Emulator, START}; use yazi_emulator::{CLOSE, ESCAPE, Emulator, START};
use yazi_shim::cell::SyncCell; use yazi_shim::cell::SyncCell;

View file

@ -4,7 +4,7 @@ use std::{io::Write, path::PathBuf};
use anyhow::Result; use anyhow::Result;
use base64::{Engine, engine::general_purpose}; use base64::{Engine, engine::general_purpose};
use image::DynamicImage; use image::DynamicImage;
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use yazi_emulator::{CLOSE, ESCAPE, Emulator, START}; use yazi_emulator::{CLOSE, ESCAPE, Emulator, START};
use yazi_tty::TTY; use yazi_tty::TTY;

View file

@ -4,7 +4,7 @@ use anyhow::{Result, bail};
use image::{DynamicImage, GenericImageView, RgbImage}; use image::{DynamicImage, GenericImageView, RgbImage};
use palette::{Srgb, cast::ComponentsAs}; use palette::{Srgb, cast::ComponentsAs};
use quantette::{PaletteSize, color_map::IndexedColorMap, wu::{BinnerU8x3, WuU8x3}}; use quantette::{PaletteSize, color_map::IndexedColorMap, wu::{BinnerU8x3, WuU8x3}};
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use yazi_config::THEME; use yazi_config::THEME;
use yazi_emulator::{CLOSE, ESCAPE, Emulator, START}; use yazi_emulator::{CLOSE, ESCAPE, Emulator, START};
use yazi_tty::sequence::{MoveTo, ResetAttrs, SetBg}; use yazi_tty::sequence::{MoveTo, ResetAttrs, SetBg};

View file

@ -2,7 +2,7 @@ use std::{path::PathBuf, process::Stdio};
use anyhow::{Result, bail}; use anyhow::{Result, bail};
use image::ImageReader; use image::ImageReader;
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}}; use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
use tracing::{debug, warn}; use tracing::{debug, warn};
use yazi_config::YAZI; use yazi_config::YAZI;

View file

@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
use anyhow::Result; use anyhow::Result;
use image::{DynamicImage, ImageDecoder, ImageError, ImageReader, Limits, codecs::{jpeg::JpegEncoder, png::PngEncoder}, imageops::FilterType, metadata::Orientation}; use image::{DynamicImage, ImageDecoder, ImageError, ImageReader, Limits, codecs::{jpeg::JpegEncoder, png::PngEncoder}, imageops::FilterType, metadata::Orientation};
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use yazi_config::YAZI; use yazi_config::YAZI;
use yazi_emulator::Dimension; use yazi_emulator::Dimension;
use yazi_fs::provider::{Provider, local::Local}; use yazi_fs::provider::{Provider, local::Local};

View file

@ -22,21 +22,19 @@ yazi-macro = { path = "../yazi-macro", version = "26.5.6" }
yazi-shim = { path = "../yazi-shim", version = "26.5.6" } yazi-shim = { path = "../yazi-shim", version = "26.5.6" }
# External dependencies # External dependencies
ansi-to-tui = { workspace = true } ansi-to-tui = { workspace = true }
anyhow = { workspace = true } anyhow = { workspace = true }
futures = { workspace = true } futures = { workspace = true }
hashbrown = { workspace = true } hashbrown = { workspace = true }
image = { workspace = true } image = { workspace = true }
inventory = { workspace = true } mlua = { workspace = true }
mlua = { workspace = true } ratatui-core = { workspace = true }
ordered-float = { workspace = true } ratatui-widgets = { workspace = true }
ratatui = { workspace = true } serde = { workspace = true }
serde = { workspace = true } serde_json = { workspace = true }
serde_json = { workspace = true } strum = { workspace = true }
strum = { workspace = true } tokio = { workspace = true }
tokio = { workspace = true } unicode-width = { workspace = true }
tracing = { workspace = true }
unicode-width = { workspace = true }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = { workspace = true } libc = { workspace = true }

View file

@ -3,10 +3,10 @@ use std::ops::Deref;
use mlua::{FromLua, IntoLua, Lua, Value}; use mlua::{FromLua, IntoLua, Lua, Value};
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct Align(pub(super) ratatui::layout::Alignment); pub struct Align(pub(super) ratatui_core::layout::Alignment);
impl Deref for Align { impl Deref for Align {
type Target = ratatui::layout::Alignment; type Target = ratatui_core::layout::Alignment;
fn deref(&self) -> &Self::Target { &self.0 } fn deref(&self) -> &Self::Target { &self.0 }
} }
@ -27,9 +27,9 @@ impl FromLua for Align {
}); });
}; };
Ok(Self(match n { Ok(Self(match n {
0 => ratatui::layout::Alignment::Left, 0 => ratatui_core::layout::Alignment::Left,
1 => ratatui::layout::Alignment::Center, 1 => ratatui_core::layout::Alignment::Center,
2 => ratatui::layout::Alignment::Right, 2 => ratatui_core::layout::Alignment::Right,
_ => Err(mlua::Error::FromLuaConversionError { _ => Err(mlua::Error::FromLuaConversionError {
from: value.type_name(), from: value.type_name(),
to: "Align".to_string(), to: "Align".to_string(),

View file

@ -27,14 +27,14 @@ impl Debug for Area {
} }
impl Area { impl Area {
pub fn size(self) -> ratatui::layout::Size { pub fn size(self) -> ratatui_core::layout::Size {
match self { match self {
Self::Rect(rect) => (*rect).into(), Self::Rect(rect) => (*rect).into(),
Self::Pos(pos) => ratatui::layout::Size { width: pos.width, height: pos.height }, Self::Pos(pos) => ratatui_core::layout::Size { width: pos.width, height: pos.height },
} }
} }
pub fn inner(self, padding: ratatui::widgets::Padding) -> Self { pub fn inner(self, padding: ratatui_widgets::block::Padding) -> Self {
match self { match self {
Self::Rect(rect) => Self::Rect(rect.pad(padding.into())), Self::Rect(rect) => Self::Rect(rect.pad(padding.into())),
Self::Pos(mut pos) => { Self::Pos(mut pos) => {
@ -46,8 +46,8 @@ impl Area {
pub fn transform( pub fn transform(
self, self,
f: impl FnOnce(Position) -> ratatui::layout::Rect, f: impl FnOnce(Position) -> ratatui_core::layout::Rect,
) -> ratatui::layout::Rect { ) -> ratatui_core::layout::Rect {
match self { match self {
Self::Rect(rect) => *rect, Self::Rect(rect) => *rect,
Self::Pos(pos) => *Rect(f(*pos)).pad(pos.pad), Self::Pos(pos) => *Rect(f(*pos)).pad(pos.pad),
@ -59,8 +59,8 @@ impl From<Rect> for Area {
fn from(rect: Rect) -> Self { Self::Rect(rect) } fn from(rect: Rect) -> Self { Self::Rect(rect) }
} }
impl From<ratatui::layout::Rect> for Area { impl From<ratatui_core::layout::Rect> for Area {
fn from(rect: ratatui::layout::Rect) -> Self { Self::Rect(rect.into()) } fn from(rect: ratatui_core::layout::Rect) -> Self { Self::Rect(rect.into()) }
} }
impl From<Position> for Area { impl From<Position> for Area {

View file

@ -1,5 +1,6 @@
use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::widgets::{Borders, Widget}; use ratatui_core::widgets::Widget;
use ratatui_widgets::borders::Borders;
use super::{Area, Edge}; use super::{Area, Edge};
use crate::elements::Spatial; use crate::elements::Spatial;
@ -10,7 +11,7 @@ pub struct Bar {
edge: Edge, edge: Edge,
symbol: String, symbol: String,
style: ratatui::style::Style, style: ratatui_core::style::Style,
} }
impl Bar { impl Bar {
@ -37,7 +38,7 @@ impl Spatial for Bar {
} }
impl Widget for &Bar { impl Widget for &Bar {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {

View file

@ -1,5 +1,6 @@
use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::widgets::{Borders, Widget}; use ratatui_core::widgets::Widget;
use ratatui_widgets::borders::Borders;
use super::{Area, Edge}; use super::{Area, Edge};
use crate::elements::{Line, Spatial}; use crate::elements::{Line, Spatial};
@ -17,17 +18,17 @@ pub struct Border {
pub area: Area, pub area: Area,
pub edge: Edge, pub edge: Edge,
pub r#type: ratatui::widgets::BorderType, pub r#type: ratatui_widgets::borders::BorderType,
pub style: ratatui::style::Style, pub style: ratatui_core::style::Style,
pub merge: ratatui::symbols::merge::MergeStrategy, pub merge: ratatui_core::symbols::merge::MergeStrategy,
pub titles: Vec<(ratatui::widgets::TitlePosition, ratatui::text::Line<'static>)>, pub titles: Vec<(ratatui_widgets::block::TitlePosition, ratatui_core::text::Line<'static>)>,
} }
impl Border { impl Border {
pub fn compose(lua: &Lua) -> mlua::Result<Value> { pub fn compose(lua: &Lua) -> mlua::Result<Value> {
let new = lua.create_function(|_, (_, edge): (Table, Edge)| { let new = lua.create_function(|_, (_, edge): (Table, Edge)| {
Ok(Self { edge, r#type: ratatui::widgets::BorderType::Rounded, ..Default::default() }) Ok(Self { edge, r#type: ratatui_widgets::borders::BorderType::Rounded, ..Default::default() })
})?; })?;
let border = lua.create_table_from([ let border = lua.create_table_from([
@ -58,11 +59,11 @@ impl Spatial for Border {
} }
impl Widget for Border { impl Widget for Border {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {
let mut block = ratatui::widgets::Block::default() let mut block = ratatui_widgets::block::Block::default()
.borders(self.edge.0) .borders(self.edge.0)
.border_type(self.r#type) .border_type(self.r#type)
.border_style(self.style) .border_style(self.style)
@ -70,8 +71,8 @@ impl Widget for Border {
for title in self.titles { for title in self.titles {
block = match title { block = match title {
(ratatui::widgets::TitlePosition::Top, line) => block.title_top(line), (ratatui_widgets::block::TitlePosition::Top, line) => block.title_top(line),
(ratatui::widgets::TitlePosition::Bottom, line) => block.title_bottom(line), (ratatui_widgets::block::TitlePosition::Bottom, line) => block.title_bottom(line),
}; };
} }
@ -80,7 +81,7 @@ impl Widget for Border {
} }
impl Widget for &Border { impl Widget for &Border {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {
@ -95,20 +96,20 @@ impl UserData for Border {
methods.add_function("type", |_, (ud, value): (AnyUserData, u8)| { methods.add_function("type", |_, (ud, value): (AnyUserData, u8)| {
ud.borrow_mut::<Self>()?.r#type = match value { ud.borrow_mut::<Self>()?.r#type = match value {
ROUNDED => ratatui::widgets::BorderType::Rounded, ROUNDED => ratatui_widgets::borders::BorderType::Rounded,
DOUBLE => ratatui::widgets::BorderType::Double, DOUBLE => ratatui_widgets::borders::BorderType::Double,
THICK => ratatui::widgets::BorderType::Thick, THICK => ratatui_widgets::borders::BorderType::Thick,
QUADRANT_INSIDE => ratatui::widgets::BorderType::QuadrantInside, QUADRANT_INSIDE => ratatui_widgets::borders::BorderType::QuadrantInside,
QUADRANT_OUTSIDE => ratatui::widgets::BorderType::QuadrantOutside, QUADRANT_OUTSIDE => ratatui_widgets::borders::BorderType::QuadrantOutside,
_ => ratatui::widgets::BorderType::Plain, _ => ratatui_widgets::borders::BorderType::Plain,
}; };
Ok(ud) Ok(ud)
}); });
methods.add_function("title", |_, (ud, line, position): (AnyUserData, Line, Option<u8>)| { methods.add_function("title", |_, (ud, line, position): (AnyUserData, Line, Option<u8>)| {
let position = if position == Some(Borders::BOTTOM.bits()) { let position = if position == Some(Borders::BOTTOM.bits()) {
ratatui::widgets::TitlePosition::Bottom ratatui_widgets::block::TitlePosition::Bottom
} else { } else {
ratatui::widgets::TitlePosition::Top ratatui_widgets::block::TitlePosition::Top
}; };
ud.borrow_mut::<Self>()?.titles.push((position, line.inner)); ud.borrow_mut::<Self>()?.titles.push((position, line.inner));
@ -120,9 +121,9 @@ impl UserData for Border {
}); });
methods.add_function("merge", |_, (ud, exact): (AnyUserData, bool)| { methods.add_function("merge", |_, (ud, exact): (AnyUserData, bool)| {
ud.borrow_mut::<Self>()?.merge = if exact { ud.borrow_mut::<Self>()?.merge = if exact {
ratatui::symbols::merge::MergeStrategy::Exact ratatui_core::symbols::merge::MergeStrategy::Exact
} else { } else {
ratatui::symbols::merge::MergeStrategy::Fuzzy ratatui_core::symbols::merge::MergeStrategy::Fuzzy
}; };
Ok(ud) Ok(ud)
}); });

View file

@ -4,10 +4,10 @@ use super::Text;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cell { pub struct Cell {
pub(super) text: ratatui::text::Text<'static>, pub(super) text: ratatui_core::text::Text<'static>,
} }
impl From<Cell> for ratatui::widgets::Cell<'static> { impl From<Cell> for ratatui_widgets::table::Cell<'static> {
fn from(value: Cell) -> Self { Self::new(value.text) } fn from(value: Cell) -> Self { Self::new(value.text) }
} }

View file

@ -3,7 +3,7 @@ use std::str::FromStr;
use mlua::{AnyUserData, ExternalError, ExternalResult, FromLua, IntoLua, Lua, MetaMethod, Table, UserData, Value}; use mlua::{AnyUserData, ExternalError, ExternalResult, FromLua, IntoLua, Lua, MetaMethod, Table, UserData, Value};
#[derive(Clone, Copy, Default)] #[derive(Clone, Copy, Default)]
pub struct Color(pub ratatui::style::Color); pub struct Color(pub ratatui_core::style::Color);
impl Color { impl Color {
pub fn compose(lua: &Lua) -> mlua::Result<Value> { pub fn compose(lua: &Lua) -> mlua::Result<Value> {
@ -25,8 +25,8 @@ impl TryFrom<&AnyUserData> for Color {
impl FromLua for Color { impl FromLua for Color {
fn from_lua(value: Value, _: &Lua) -> mlua::Result<Self> { fn from_lua(value: Value, _: &Lua) -> mlua::Result<Self> {
Ok(Self(match value { Ok(Self(match value {
Value::Nil => ratatui::style::Color::Reset, Value::Nil => ratatui_core::style::Color::Reset,
Value::String(s) => ratatui::style::Color::from_str(&s.to_str()?).into_lua_err()?, Value::String(s) => ratatui_core::style::Color::from_str(&s.to_str()?).into_lua_err()?,
Value::UserData(ud) => return Self::try_from(&ud), Value::UserData(ud) => return Self::try_from(&ud),
_ => Err("expected a Color".into_lua_err())?, _ => Err("expected a Color".into_lua_err())?,
})) }))

View file

@ -1,11 +1,11 @@
use mlua::{FromLua, IntoLua, Lua, UserData, Value}; use mlua::{FromLua, IntoLua, Lua, UserData, Value};
#[derive(Clone, Copy, Default, FromLua)] #[derive(Clone, Copy, Default, FromLua)]
pub struct Constraint(pub(super) ratatui::layout::Constraint); pub struct Constraint(pub(super) ratatui_core::layout::Constraint);
impl Constraint { impl Constraint {
pub fn compose(lua: &Lua) -> mlua::Result<Value> { pub fn compose(lua: &Lua) -> mlua::Result<Value> {
use ratatui::layout::Constraint as C; use ratatui_core::layout::Constraint as C;
lua lua
.create_table_from([ .create_table_from([
@ -20,7 +20,7 @@ impl Constraint {
} }
} }
impl From<Constraint> for ratatui::layout::Constraint { impl From<Constraint> for ratatui_core::layout::Constraint {
fn from(value: Constraint) -> Self { value.0 } fn from(value: Constraint) -> Self { value.0 }
} }

View file

@ -1,7 +1,7 @@
use std::ops::Deref; use std::ops::Deref;
use mlua::{FromLua, IntoLua, Lua, Value}; use mlua::{FromLua, IntoLua, Lua, Value};
use ratatui::widgets::Borders; use ratatui_widgets::borders::Borders;
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct Edge(pub Borders); pub struct Edge(pub Borders);

View file

@ -1,5 +1,5 @@
use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::widgets::Widget; use ratatui_core::widgets::Widget;
use super::Area; use super::Area;
use crate::elements::Spatial; use crate::elements::Spatial;
@ -8,7 +8,7 @@ use crate::elements::Spatial;
pub struct Fill { pub struct Fill {
area: Area, area: Area,
style: ratatui::style::Style, style: ratatui_core::style::Style,
} }
impl Fill { impl Fill {
@ -36,7 +36,7 @@ impl Spatial for Fill {
} }
impl Widget for &Fill { impl Widget for &Fill {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {

View file

@ -1,5 +1,5 @@
use mlua::{AnyUserData, ExternalError, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, ExternalError, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::widgets::Widget; use ratatui_core::widgets::Widget;
use super::{Area, Span}; use super::{Area, Span};
use crate::{elements::Spatial, style::Style}; use crate::{elements::Spatial, style::Style};
@ -9,9 +9,9 @@ pub struct Gauge {
area: Area, area: Area,
ratio: f64, ratio: f64,
label: Option<ratatui::text::Span<'static>>, label: Option<ratatui_core::text::Span<'static>>,
style: ratatui::style::Style, style: ratatui_core::style::Style,
gauge_style: ratatui::style::Style, gauge_style: ratatui_core::style::Style,
} }
impl Gauge { impl Gauge {
@ -38,11 +38,11 @@ impl Spatial for Gauge {
} }
impl Widget for Gauge { impl Widget for Gauge {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {
let mut gauge = ratatui::widgets::Gauge::default() let mut gauge = ratatui_widgets::gauge::Gauge::default()
.ratio(self.ratio) .ratio(self.ratio)
.style(self.style) .style(self.style)
.gauge_style(self.gauge_style); .gauge_style(self.gauge_style);
@ -56,7 +56,7 @@ impl Widget for Gauge {
} }
impl Widget for &Gauge { impl Widget for &Gauge {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {

View file

@ -8,8 +8,8 @@ const VERTICAL: bool = false;
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct Layout { pub struct Layout {
direction: bool, direction: bool,
margin: Option<ratatui::layout::Margin>, margin: Option<ratatui_core::layout::Margin>,
constraints: Vec<ratatui::layout::Constraint>, constraints: Vec<ratatui_core::layout::Constraint>,
} }
impl Layout { impl Layout {
@ -30,7 +30,7 @@ impl UserData for Layout {
Ok(ud) Ok(ud)
}); });
methods.add_function("margin", |_, (ud, value): (AnyUserData, u16)| { methods.add_function("margin", |_, (ud, value): (AnyUserData, u16)| {
ud.borrow_mut::<Self>()?.margin = Some(ratatui::layout::Margin::new(value, value)); ud.borrow_mut::<Self>()?.margin = Some(ratatui_core::layout::Margin::new(value, value));
Ok(ud) Ok(ud)
}); });
methods.add_function("margin_h", |_, (ud, value): (AnyUserData, u16)| { methods.add_function("margin_h", |_, (ud, value): (AnyUserData, u16)| {
@ -39,7 +39,7 @@ impl UserData for Layout {
if let Some(margin) = &mut me.margin { if let Some(margin) = &mut me.margin {
margin.horizontal = value; margin.horizontal = value;
} else { } else {
me.margin = Some(ratatui::layout::Margin::new(value, 0)); me.margin = Some(ratatui_core::layout::Margin::new(value, 0));
} }
} }
Ok(ud) Ok(ud)
@ -50,7 +50,7 @@ impl UserData for Layout {
if let Some(margin) = &mut me.margin { if let Some(margin) = &mut me.margin {
margin.vertical = value; margin.vertical = value;
} else { } else {
me.margin = Some(ratatui::layout::Margin::new(0, value)); me.margin = Some(ratatui_core::layout::Margin::new(0, value));
} }
} }
Ok(ud) Ok(ud)
@ -60,11 +60,11 @@ impl UserData for Layout {
Ok(ud) Ok(ud)
}); });
methods.add_method("split", |lua, me, value: Rect| { methods.add_method("split", |lua, me, value: Rect| {
let mut layout = ratatui::layout::Layout::new( let mut layout = ratatui_core::layout::Layout::new(
if me.direction == VERTICAL { if me.direction == VERTICAL {
ratatui::layout::Direction::Vertical ratatui_core::layout::Direction::Vertical
} else { } else {
ratatui::layout::Direction::Horizontal ratatui_core::layout::Direction::Horizontal
}, },
&me.constraints, &me.constraints,
); );

View file

@ -2,7 +2,7 @@ use std::{borrow::Cow, mem, ops::{Deref, DerefMut}};
use ansi_to_tui::IntoText; use ansi_to_tui::IntoText;
use mlua::{AnyUserData, ExternalError, ExternalResult, FromLua, Function, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, ExternalError, ExternalResult, FromLua, Function, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::widgets::Widget; use ratatui_core::widgets::Widget;
use unicode_width::UnicodeWidthChar; use unicode_width::UnicodeWidthChar;
use super::{Area, Span}; use super::{Area, Span};
@ -14,11 +14,11 @@ const EXPECTED: &str = "expected a string, Span, Line, or a table of them";
pub struct Line { pub struct Line {
area: Area, area: Area,
pub(super) inner: ratatui::text::Line<'static>, pub(super) inner: ratatui_core::text::Line<'static>,
} }
impl Deref for Line { impl Deref for Line {
type Target = ratatui::text::Line<'static>; type Target = ratatui_core::text::Line<'static>;
fn deref(&self) -> &Self::Target { &self.inner } fn deref(&self) -> &Self::Target { &self.inner }
} }
@ -51,8 +51,8 @@ impl Line {
} }
} }
impl From<ratatui::text::Line<'static>> for Line { impl From<ratatui_core::text::Line<'static>> for Line {
fn from(value: ratatui::text::Line<'static>) -> Self { fn from(value: ratatui_core::text::Line<'static>) -> Self {
Self { inner: value, ..Default::default() } Self { inner: value, ..Default::default() }
} }
} }
@ -96,7 +96,7 @@ impl TryFrom<Table> for Line {
} }
} }
impl From<Line> for ratatui::text::Line<'static> { impl From<Line> for ratatui_core::text::Line<'static> {
fn from(value: Line) -> Self { value.inner } fn from(value: Line) -> Self { value.inner }
} }
@ -107,7 +107,7 @@ impl Spatial for Line {
} }
impl Widget for &Line { impl Widget for &Line {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {
@ -157,7 +157,7 @@ impl UserData for Line {
} }
let ellipsis = match t.raw_get::<Value>("ellipsis")? { let ellipsis = match t.raw_get::<Value>("ellipsis")? {
Value::Nil => (1, ratatui::text::Span::raw("")), Value::Nil => (1, ratatui_core::text::Span::raw("")),
v => { v => {
let mut span = Span::from_lua(v, lua)?; let mut span = Span::from_lua(v, lua)?;
(span.truncate(max), span.0) (span.truncate(max), span.0)

View file

@ -1,5 +1,5 @@
use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::widgets::Widget; use ratatui_core::widgets::Widget;
use super::{Area, Text}; use super::{Area, Text};
use crate::elements::Spatial; use crate::elements::Spatial;
@ -9,13 +9,13 @@ use crate::elements::Spatial;
pub struct List { pub struct List {
area: Area, area: Area,
inner: ratatui::widgets::List<'static>, inner: ratatui_widgets::list::List<'static>,
} }
impl List { impl List {
pub fn compose(lua: &Lua) -> mlua::Result<Value> { pub fn compose(lua: &Lua) -> mlua::Result<Value> {
let new = lua.create_function(|_, (_, items): (Table, Vec<Text>)| { let new = lua.create_function(|_, (_, items): (Table, Vec<Text>)| {
Ok(Self { inner: ratatui::widgets::List::new(items), ..Default::default() }) Ok(Self { inner: ratatui_widgets::list::List::new(items), ..Default::default() })
})?; })?;
let list = lua.create_table()?; let list = lua.create_table()?;
@ -38,7 +38,7 @@ impl Spatial for List {
} }
impl Widget for &List { impl Widget for &List {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {

View file

@ -3,46 +3,64 @@ use std::ops::{Add, AddAssign, Deref};
use mlua::{FromLua, IntoLua, Lua, MetaMethod, Table, UserData, UserDataFields, Value}; use mlua::{FromLua, IntoLua, Lua, MetaMethod, Table, UserData, UserDataFields, Value};
#[derive(Clone, Copy, Default, FromLua)] #[derive(Clone, Copy, Default, FromLua)]
pub struct Pad(ratatui::widgets::Padding); pub struct Pad(ratatui_widgets::block::Padding);
impl Deref for Pad { impl Deref for Pad {
type Target = ratatui::widgets::Padding; type Target = ratatui_widgets::block::Padding;
fn deref(&self) -> &Self::Target { &self.0 } fn deref(&self) -> &Self::Target { &self.0 }
} }
impl From<ratatui::widgets::Padding> for Pad { impl From<ratatui_widgets::block::Padding> for Pad {
fn from(pad: ratatui::widgets::Padding) -> Self { Self(pad) } fn from(pad: ratatui_widgets::block::Padding) -> Self { Self(pad) }
} }
impl Pad { impl Pad {
pub fn compose(lua: &Lua) -> mlua::Result<Value> { pub fn compose(lua: &Lua) -> mlua::Result<Value> {
let new = let new =
lua.create_function(|_, (_, top, right, bottom, left): (Table, u16, u16, u16, u16)| { lua.create_function(|_, (_, top, right, bottom, left): (Table, u16, u16, u16, u16)| {
Ok(Self(ratatui::widgets::Padding::new(left, right, top, bottom))) Ok(Self(ratatui_widgets::block::Padding::new(left, right, top, bottom)))
})?; })?;
let pad = lua.create_table_from([ let pad = lua.create_table_from([
( (
"left", "left",
lua.create_function(|_, left: u16| Ok(Self(ratatui::widgets::Padding::left(left))))?, lua
.create_function(|_, left: u16| Ok(Self(ratatui_widgets::block::Padding::left(left))))?,
), ),
( (
"right", "right",
lua.create_function(|_, right: u16| Ok(Self(ratatui::widgets::Padding::right(right))))?, lua.create_function(|_, right: u16| {
Ok(Self(ratatui_widgets::block::Padding::right(right)))
})?,
),
(
"top",
lua.create_function(|_, top: u16| Ok(Self(ratatui_widgets::block::Padding::top(top))))?,
), ),
("top", lua.create_function(|_, top: u16| Ok(Self(ratatui::widgets::Padding::top(top))))?),
( (
"bottom", "bottom",
lua lua.create_function(|_, bottom: u16| {
.create_function(|_, bottom: u16| Ok(Self(ratatui::widgets::Padding::bottom(bottom))))?, Ok(Self(ratatui_widgets::block::Padding::bottom(bottom)))
})?,
),
(
"x",
lua.create_function(|_, x: u16| {
Ok(Self(ratatui_widgets::block::Padding::new(x, x, 0, 0)))
})?,
),
(
"y",
lua.create_function(|_, y: u16| {
Ok(Self(ratatui_widgets::block::Padding::new(0, 0, y, y)))
})?,
), ),
("x", lua.create_function(|_, x: u16| Ok(Self(ratatui::widgets::Padding::new(x, x, 0, 0))))?),
("y", lua.create_function(|_, y: u16| Ok(Self(ratatui::widgets::Padding::new(0, 0, y, y))))?),
( (
"xy", "xy",
lua lua.create_function(|_, xy: u16| {
.create_function(|_, xy: u16| Ok(Self(ratatui::widgets::Padding::new(xy, xy, xy, xy))))?, Ok(Self(ratatui_widgets::block::Padding::new(xy, xy, xy, xy)))
})?,
), ),
])?; ])?;
@ -60,11 +78,11 @@ impl UserData for Pad {
} }
} }
impl Add<ratatui::widgets::Padding> for Pad { impl Add<ratatui_widgets::block::Padding> for Pad {
type Output = Self; type Output = Self;
fn add(self, rhs: ratatui::widgets::Padding) -> Self::Output { fn add(self, rhs: ratatui_widgets::block::Padding) -> Self::Output {
Self(ratatui::widgets::Padding::new( Self(ratatui_widgets::block::Padding::new(
self.left.saturating_add(rhs.left), self.left.saturating_add(rhs.left),
self.right.saturating_add(rhs.right), self.right.saturating_add(rhs.right),
self.top.saturating_add(rhs.top), self.top.saturating_add(rhs.top),
@ -73,6 +91,6 @@ impl Add<ratatui::widgets::Padding> for Pad {
} }
} }
impl AddAssign<ratatui::widgets::Padding> for Pad { impl AddAssign<ratatui_widgets::block::Padding> for Pad {
fn add_assign(&mut self, rhs: ratatui::widgets::Padding) { *self = *self + rhs; } fn add_assign(&mut self, rhs: ratatui_widgets::block::Padding) { *self = *self + rhs; }
} }

View file

@ -5,28 +5,33 @@ use mlua::{FromLua, IntoLua, Lua, MetaMethod, Table, UserData, UserDataFields, U
use super::Pad; use super::Pad;
#[derive(Clone, Copy, Debug, Default, FromLua)] #[derive(Clone, Copy, Debug, Default, FromLua)]
pub struct Rect(pub ratatui::layout::Rect); pub struct Rect(pub ratatui_core::layout::Rect);
impl Deref for Rect { impl Deref for Rect {
type Target = ratatui::layout::Rect; type Target = ratatui_core::layout::Rect;
fn deref(&self) -> &Self::Target { &self.0 } fn deref(&self) -> &Self::Target { &self.0 }
} }
impl From<ratatui::layout::Rect> for Rect { impl From<ratatui_core::layout::Rect> for Rect {
fn from(rect: ratatui::layout::Rect) -> Self { Self(rect) } fn from(rect: ratatui_core::layout::Rect) -> Self { Self(rect) }
} }
impl From<ratatui::layout::Size> for Rect { impl From<ratatui_core::layout::Size> for Rect {
fn from(size: ratatui::layout::Size) -> Self { fn from(size: ratatui_core::layout::Size) -> Self {
Self(ratatui::layout::Rect { x: 0, y: 0, width: size.width, height: size.height }) Self(ratatui_core::layout::Rect {
x: 0,
y: 0,
width: size.width,
height: size.height,
})
} }
} }
impl Rect { impl Rect {
pub fn compose(lua: &Lua) -> mlua::Result<Value> { pub fn compose(lua: &Lua) -> mlua::Result<Value> {
let new = lua.create_function(|_, (_, args): (Table, Table)| { let new = lua.create_function(|_, (_, args): (Table, Table)| {
Ok(Self(ratatui::layout::Rect { Ok(Self(ratatui_core::layout::Rect {
x: args.raw_get("x").unwrap_or_default(), x: args.raw_get("x").unwrap_or_default(),
y: args.raw_get("y").unwrap_or_default(), y: args.raw_get("y").unwrap_or_default(),
width: args.raw_get("w").unwrap_or_default(), width: args.raw_get("w").unwrap_or_default(),
@ -50,7 +55,7 @@ impl Rect {
} }
fn patch(self, t: Table) -> mlua::Result<Self> { fn patch(self, t: Table) -> mlua::Result<Self> {
Ok(Self(ratatui::layout::Rect { Ok(Self(ratatui_core::layout::Rect {
x: t.raw_get::<Option<_>>("x")?.unwrap_or(self.x), x: t.raw_get::<Option<_>>("x")?.unwrap_or(self.x),
y: t.raw_get::<Option<_>>("y")?.unwrap_or(self.y), y: t.raw_get::<Option<_>>("y")?.unwrap_or(self.y),
width: t.raw_get::<Option<_>>("w")?.unwrap_or(self.width), width: t.raw_get::<Option<_>>("w")?.unwrap_or(self.width),

View file

@ -10,7 +10,7 @@ pub struct Row {
height: u16, height: u16,
top_margin: u16, top_margin: u16,
bottom_margin: u16, bottom_margin: u16,
style: ratatui::style::Style, style: ratatui_core::style::Style,
} }
impl Row { impl Row {
@ -26,7 +26,7 @@ impl Row {
} }
} }
impl From<Row> for ratatui::widgets::Row<'static> { impl From<Row> for ratatui_widgets::table::Row<'static> {
fn from(value: Row) -> Self { fn from(value: Row) -> Self {
Self::new(value.cells) Self::new(value.cells)
.height(value.height.max(1)) .height(value.height.max(1))

View file

@ -5,10 +5,10 @@ use unicode_width::UnicodeWidthChar;
const EXPECTED: &str = "expected a string or Span"; const EXPECTED: &str = "expected a string or Span";
pub struct Span(pub(super) ratatui::text::Span<'static>); pub struct Span(pub(super) ratatui_core::text::Span<'static>);
impl Deref for Span { impl Deref for Span {
type Target = ratatui::text::Span<'static>; type Target = ratatui_core::text::Span<'static>;
fn deref(&self) -> &Self::Target { &self.0 } fn deref(&self) -> &Self::Target { &self.0 }
} }

View file

@ -1,5 +1,5 @@
use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Value};
use ratatui::widgets::{StatefulWidget, Widget}; use ratatui_core::widgets::{StatefulWidget, Widget};
use super::{Area, Row}; use super::{Area, Row};
use crate::{elements::{Constraint, Spatial}, style::Style}; use crate::{elements::{Constraint, Spatial}, style::Style};
@ -10,23 +10,23 @@ pub struct Table {
area: Area, area: Area,
rows: Vec<Row>, rows: Vec<Row>,
header: Option<ratatui::widgets::Row<'static>>, header: Option<ratatui_widgets::table::Row<'static>>,
footer: Option<ratatui::widgets::Row<'static>>, footer: Option<ratatui_widgets::table::Row<'static>>,
widths: Vec<ratatui::layout::Constraint>, widths: Vec<ratatui_core::layout::Constraint>,
column_spacing: u16, column_spacing: u16,
block: Option<ratatui::widgets::Block<'static>>, // TODO block: Option<ratatui_widgets::block::Block<'static>>, // TODO
style: ratatui::style::Style, style: ratatui_core::style::Style,
row_highlight_style: ratatui::style::Style, row_highlight_style: ratatui_core::style::Style,
column_highlight_style: ratatui::style::Style, column_highlight_style: ratatui_core::style::Style,
cell_highlight_style: ratatui::style::Style, cell_highlight_style: ratatui_core::style::Style,
highlight_symbol: ratatui::text::Text<'static>, // TODO highlight_symbol: ratatui_core::text::Text<'static>, // TODO
highlight_spacing: ratatui::widgets::HighlightSpacing, // TODO highlight_spacing: ratatui_widgets::table::HighlightSpacing, // TODO
flex: ratatui::layout::Flex, flex: ratatui_core::layout::Flex,
state: ratatui::widgets::TableState, state: ratatui_widgets::table::TableState,
} }
impl Table { impl Table {
@ -41,7 +41,7 @@ impl Table {
table.into_lua(lua) table.into_lua(lua)
} }
pub fn selected_cell(&self) -> Option<&ratatui::text::Text<'_>> { pub fn selected_cell(&self) -> Option<&ratatui_core::text::Text<'_>> {
let row = &self.rows[self.selected()?]; let row = &self.rows[self.selected()?];
let col = self.state.selected_column()?; let col = self.state.selected_column()?;
if row.cells.is_empty() { None } else { Some(&row.cells[col.min(row.cells.len() - 1)].text) } if row.cells.is_empty() { None } else { Some(&row.cells[col.min(row.cells.len() - 1)].text) }
@ -73,11 +73,11 @@ impl Spatial for Table {
} }
impl Widget for Table { impl Widget for Table {
fn render(mut self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(mut self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {
let mut table = ratatui::widgets::Table::new(self.rows, self.widths) let mut table = ratatui_widgets::table::Table::new(self.rows, self.widths)
.column_spacing(self.column_spacing) .column_spacing(self.column_spacing)
.style(self.style) .style(self.style)
.row_highlight_style(self.row_highlight_style) .row_highlight_style(self.row_highlight_style)
@ -102,7 +102,7 @@ impl Widget for Table {
} }
impl Widget for &Table { impl Widget for &Table {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {

View file

@ -2,7 +2,7 @@ use std::{any::TypeId, mem};
use ansi_to_tui::IntoText; use ansi_to_tui::IntoText;
use mlua::{AnyUserData, ExternalError, ExternalResult, FromLua, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, ExternalError, ExternalResult, FromLua, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::widgets::Widget; use ratatui_core::widgets::Widget;
use yazi_shim::SStr; use yazi_shim::SStr;
use super::{Area, Line, Span, Wrap}; use super::{Area, Line, Span, Wrap};
@ -15,9 +15,9 @@ pub struct Text {
area: Area, area: Area,
// TODO: block // TODO: block
pub inner: ratatui::text::Text<'static>, pub inner: ratatui_core::text::Text<'static>,
pub wrap: Wrap, pub wrap: Wrap,
pub scroll: ratatui::layout::Position, pub scroll: ratatui_core::layout::Position,
} }
impl Text { impl Text {
@ -39,8 +39,8 @@ impl Text {
} }
} }
impl From<ratatui::text::Text<'static>> for Text { impl From<ratatui_core::text::Text<'static>> for Text {
fn from(inner: ratatui::text::Text<'static>) -> Self { Self { inner, ..Default::default() } } fn from(inner: ratatui_core::text::Text<'static>) -> Self { Self { inner, ..Default::default() } }
} }
impl From<SStr> for Text { impl From<SStr> for Text {
@ -68,16 +68,16 @@ impl TryFrom<Table> for Text {
} }
} }
impl From<Text> for ratatui::text::Text<'static> { impl From<Text> for ratatui_core::text::Text<'static> {
fn from(value: Text) -> Self { value.inner } fn from(value: Text) -> Self { value.inner }
} }
impl From<Text> for ratatui::widgets::Paragraph<'static> { impl From<Text> for ratatui_widgets::paragraph::Paragraph<'static> {
fn from(mut value: Text) -> Self { fn from(mut value: Text) -> Self {
let align = value.inner.alignment.take(); let align = value.inner.alignment.take();
let style = mem::take(&mut value.inner.style); let style = mem::take(&mut value.inner.style);
let mut p = ratatui::widgets::Paragraph::new(value.inner).style(style); let mut p = ratatui_widgets::paragraph::Paragraph::new(value.inner).style(style);
if let Some(align) = align { if let Some(align) = align {
p = p.alignment(align); p = p.alignment(align);
} }
@ -95,27 +95,27 @@ impl Spatial for Text {
} }
impl Widget for Text { impl Widget for Text {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {
if self.wrap.is_none() && self.scroll == Default::default() { if self.wrap.is_none() && self.scroll == Default::default() {
self.inner.render(rect, buf); self.inner.render(rect, buf);
} else { } else {
ratatui::widgets::Paragraph::from(self).render(rect, buf); ratatui_widgets::paragraph::Paragraph::from(self).render(rect, buf);
} }
} }
} }
impl Widget for &Text { impl Widget for &Text {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {
if self.wrap.is_none() && self.scroll == Default::default() { if self.wrap.is_none() && self.scroll == Default::default() {
(&self.inner).render(rect, buf); (&self.inner).render(rect, buf);
} else { } else {
ratatui::widgets::Paragraph::from(self.clone()).render(rect, buf); ratatui_widgets::paragraph::Paragraph::from(self.clone()).render(rect, buf);
} }
} }
} }
@ -162,7 +162,7 @@ impl UserData for Text {
Ok(ud) Ok(ud)
}); });
methods.add_function("scroll", |_, (ud, x, y): (AnyUserData, u16, u16)| { methods.add_function("scroll", |_, (ud, x, y): (AnyUserData, u16, u16)| {
ud.borrow_mut::<Self>()?.scroll = ratatui::layout::Position { x, y }; ud.borrow_mut::<Self>()?.scroll = ratatui_core::layout::Position { x, y };
Ok(ud) Ok(ud)
}); });
methods.add_method("max_width", |_, me, ()| { methods.add_method("max_width", |_, me, ()| {

View file

@ -3,10 +3,10 @@ use std::ops::Deref;
use mlua::{FromLua, IntoLua, Lua, Value}; use mlua::{FromLua, IntoLua, Lua, Value};
#[derive(Clone, Copy, Debug, Default)] #[derive(Clone, Copy, Debug, Default)]
pub struct Wrap(pub Option<ratatui::widgets::Wrap>); pub struct Wrap(pub Option<ratatui_widgets::paragraph::Wrap>);
impl Deref for Wrap { impl Deref for Wrap {
type Target = Option<ratatui::widgets::Wrap>; type Target = Option<ratatui_widgets::paragraph::Wrap>;
fn deref(&self) -> &Self::Target { &self.0 } fn deref(&self) -> &Self::Target { &self.0 }
} }
@ -17,12 +17,12 @@ impl Wrap {
} }
} }
impl From<Wrap> for Option<ratatui::widgets::Wrap> { impl From<Wrap> for Option<ratatui_widgets::paragraph::Wrap> {
fn from(value: Wrap) -> Self { value.0 } fn from(value: Wrap) -> Self { value.0 }
} }
impl From<ratatui::widgets::Wrap> for Wrap { impl From<ratatui_widgets::paragraph::Wrap> for Wrap {
fn from(value: ratatui::widgets::Wrap) -> Self { Self(Some(value)) } fn from(value: ratatui_widgets::paragraph::Wrap) -> Self { Self(Some(value)) }
} }
impl FromLua for Wrap { impl FromLua for Wrap {
@ -36,8 +36,8 @@ impl FromLua for Wrap {
}; };
Ok(Self(match n { Ok(Self(match n {
0 => None, 0 => None,
1 => Some(ratatui::widgets::Wrap { trim: false }), 1 => Some(ratatui_widgets::paragraph::Wrap { trim: false }),
2 => Some(ratatui::widgets::Wrap { trim: true }), 2 => Some(ratatui_widgets::paragraph::Wrap { trim: true }),
_ => Err(mlua::Error::FromLuaConversionError { _ => Err(mlua::Error::FromLuaConversionError {
from: value.type_name(), from: value.type_name(),
to: "Wrap".to_string(), to: "Wrap".to_string(),
@ -51,8 +51,8 @@ impl IntoLua for Wrap {
fn into_lua(self, lua: &Lua) -> mlua::Result<Value> { fn into_lua(self, lua: &Lua) -> mlua::Result<Value> {
match self.0 { match self.0 {
None => 0.into_lua(lua), None => 0.into_lua(lua),
Some(ratatui::widgets::Wrap { trim: false }) => 1.into_lua(lua), Some(ratatui_widgets::paragraph::Wrap { trim: false }) => 1.into_lua(lua),
Some(ratatui::widgets::Wrap { trim: true }) => 2.into_lua(lua), Some(ratatui_widgets::paragraph::Wrap { trim: true }) => 2.into_lua(lua),
} }
} }
} }

View file

@ -79,7 +79,7 @@ macro_rules! impl_style_shorthands {
$methods.add_function("fg", |lua, (ud, value): (mlua::AnyUserData, mlua::Value)| { $methods.add_function("fg", |lua, (ud, value): (mlua::AnyUserData, mlua::Value)| {
use $crate::elements::Color; use $crate::elements::Color;
use mlua::FromLua; use mlua::FromLua;
use ratatui::style::Modifier; use ratatui_core::style::Modifier;
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
match value { match value {
@ -98,7 +98,7 @@ macro_rules! impl_style_shorthands {
$methods.add_function("bg", |lua, (ud, value): (mlua::AnyUserData, mlua::Value)| { $methods.add_function("bg", |lua, (ud, value): (mlua::AnyUserData, mlua::Value)| {
use $crate::elements::Color; use $crate::elements::Color;
use mlua::FromLua; use mlua::FromLua;
use ratatui::style::Modifier; use ratatui_core::style::Modifier;
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
match value { match value {
@ -117,86 +117,86 @@ macro_rules! impl_style_shorthands {
$methods.add_function("bold", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("bold", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::BOLD); *me = me.remove_modifier(ratatui_core::style::Modifier::BOLD);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::BOLD); *me = me.add_modifier(ratatui_core::style::Modifier::BOLD);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("dim", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("dim", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::DIM); *me = me.remove_modifier(ratatui_core::style::Modifier::DIM);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::DIM); *me = me.add_modifier(ratatui_core::style::Modifier::DIM);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("italic", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("italic", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::ITALIC); *me = me.remove_modifier(ratatui_core::style::Modifier::ITALIC);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::ITALIC); *me = me.add_modifier(ratatui_core::style::Modifier::ITALIC);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("underline", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("underline", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::UNDERLINED); *me = me.remove_modifier(ratatui_core::style::Modifier::UNDERLINED);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::UNDERLINED); *me = me.add_modifier(ratatui_core::style::Modifier::UNDERLINED);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("blink", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("blink", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::SLOW_BLINK); *me = me.remove_modifier(ratatui_core::style::Modifier::SLOW_BLINK);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::SLOW_BLINK); *me = me.add_modifier(ratatui_core::style::Modifier::SLOW_BLINK);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("blink_rapid", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("blink_rapid", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::RAPID_BLINK); *me = me.remove_modifier(ratatui_core::style::Modifier::RAPID_BLINK);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::RAPID_BLINK); *me = me.add_modifier(ratatui_core::style::Modifier::RAPID_BLINK);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("reverse", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("reverse", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::REVERSED); *me = me.remove_modifier(ratatui_core::style::Modifier::REVERSED);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::REVERSED); *me = me.add_modifier(ratatui_core::style::Modifier::REVERSED);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("hidden", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("hidden", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::HIDDEN); *me = me.remove_modifier(ratatui_core::style::Modifier::HIDDEN);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::HIDDEN); *me = me.add_modifier(ratatui_core::style::Modifier::HIDDEN);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("crossed", |_, (ud, remove): (mlua::AnyUserData, bool)| { $methods.add_function("crossed", |_, (ud, remove): (mlua::AnyUserData, bool)| {
let me = &mut ud.borrow_mut::<Self>()?.$($field).+; let me = &mut ud.borrow_mut::<Self>()?.$($field).+;
if remove { if remove {
*me = me.remove_modifier(ratatui::style::Modifier::CROSSED_OUT); *me = me.remove_modifier(ratatui_core::style::Modifier::CROSSED_OUT);
} else { } else {
*me = me.add_modifier(ratatui::style::Modifier::CROSSED_OUT); *me = me.add_modifier(ratatui_core::style::Modifier::CROSSED_OUT);
} }
Ok(ud) Ok(ud)
}); });
$methods.add_function("reset", |_, ud: mlua::AnyUserData| { $methods.add_function("reset", |_, ud: mlua::AnyUserData| {
ud.borrow_mut::<Self>()?.$($field).+ = ratatui::style::Style::reset(); ud.borrow_mut::<Self>()?.$($field).+ = ratatui_core::style::Style::reset();
Ok(ud) Ok(ud)
}); });
}; };

View file

@ -1,6 +1,7 @@
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use ratatui::{layout::Rect, widgets::Padding}; use ratatui_core::layout::Rect;
use ratatui_widgets::block::Padding;
use super::{Offset, Origin}; use super::{Offset, Origin};

View file

@ -1,16 +1,16 @@
use std::ops::Deref; use std::ops::Deref;
use mlua::{ExternalError, FromLua, IntoLua, Lua, LuaSerdeExt, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{ExternalError, FromLua, IntoLua, Lua, LuaSerdeExt, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::style::Modifier; use ratatui_core::style::Modifier;
use yazi_shim::{cell::SyncCell, mlua::SER_OPT}; use yazi_shim::{cell::SyncCell, mlua::SER_OPT};
use crate::{elements::Color, style::StyleFlat}; use crate::{elements::Color, style::StyleFlat};
#[derive(Clone, Copy, Default)] #[derive(Clone, Copy, Default)]
pub struct Style(pub ratatui::style::Style); pub struct Style(pub ratatui_core::style::Style);
impl Deref for Style { impl Deref for Style {
type Target = ratatui::style::Style; type Target = ratatui_core::style::Style;
fn deref(&self) -> &Self::Target { &self.0 } fn deref(&self) -> &Self::Target { &self.0 }
} }
@ -23,7 +23,7 @@ impl From<&SyncCell<StyleFlat>> for Style {
fn from(value: &SyncCell<StyleFlat>) -> Self { value.get().into() } fn from(value: &SyncCell<StyleFlat>) -> Self { value.get().into() }
} }
impl From<Style> for ratatui::style::Style { impl From<Style> for ratatui_core::style::Style {
fn from(value: Style) -> Self { value.0 } fn from(value: Style) -> Self { value.0 }
} }

View file

@ -1,4 +1,4 @@
use ratatui::style::Color; use ratatui_core::style::Color;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, Default, Deserialize, Serialize)]
@ -16,10 +16,10 @@ pub struct StyleFlat {
pub crossed: Option<bool>, pub crossed: Option<bool>,
} }
impl From<ratatui::style::Style> for StyleFlat { impl From<ratatui_core::style::Style> for StyleFlat {
#[rustfmt::skip] #[rustfmt::skip]
fn from(value: ratatui::style::Style) -> Self { fn from(value: ratatui_core::style::Style) -> Self {
use ratatui::style::Modifier as M; use ratatui_core::style::Modifier as M;
let sub = value.sub_modifier; let sub = value.sub_modifier;
let all = value.add_modifier - sub; let all = value.add_modifier - sub;
@ -40,10 +40,10 @@ impl From<ratatui::style::Style> for StyleFlat {
} }
} }
impl From<StyleFlat> for ratatui::style::Style { impl From<StyleFlat> for ratatui_core::style::Style {
#[rustfmt::skip] #[rustfmt::skip]
fn from(value: StyleFlat) -> Self { fn from(value: StyleFlat) -> Self {
use ratatui::style::Modifier as M; use ratatui_core::style::Modifier as M;
let (mut add, mut sub) = (M::empty(), M::empty()); let (mut add, mut sub) = (M::empty(), M::empty());
if let Some(b) = value.bold { if let Some(b) = value.bold {
@ -85,7 +85,7 @@ impl From<StyleFlat> for ratatui::style::Style {
} }
impl StyleFlat { impl StyleFlat {
pub fn derive(self, other: ratatui::style::Style) -> ratatui::style::Style { pub fn derive(self, other: ratatui_core::style::Style) -> ratatui_core::style::Style {
ratatui::style::Style::from(self).patch(other) ratatui_core::style::Style::from(self).patch(other)
} }
} }

View file

@ -24,18 +24,19 @@ yazi-tty = { path = "../yazi-tty", version = "26.5.9" }
yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" } yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }
arc-swap = { workspace = true } arc-swap = { workspace = true }
bitflags = { workspace = true } bitflags = { workspace = true }
globset = { workspace = true } globset = { workspace = true }
hashbrown = { workspace = true } hashbrown = { workspace = true }
indexmap = { workspace = true } indexmap = { workspace = true }
inventory = { workspace = true } inventory = { workspace = true }
mlua = { workspace = true } mlua = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
regex = { workspace = true } ratatui-widgets = { workspace = true }
serde = { workspace = true } regex = { workspace = true }
serde_with = { workspace = true } serde = { workspace = true }
tokio = { workspace = true } serde_with = { workspace = true }
toml = { workspace = true } tokio = { workspace = true }
tracing = { workspace = true } toml = { workspace = true }
tracing = { workspace = true }

View file

@ -1,4 +1,4 @@
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
#[derive(Clone, Copy, Default, Eq, PartialEq)] #[derive(Clone, Copy, Default, Eq, PartialEq)]
pub struct Layout { pub struct Layout {

View file

@ -1,4 +1,5 @@
use ratatui::{text::{Line, Text}, widgets::{Paragraph, Wrap}}; use ratatui_core::text::{Line, Text};
use ratatui_widgets::paragraph::{Paragraph, Wrap};
use yazi_binding::position::Position; use yazi_binding::position::Position;
use yazi_macro::impl_data_any; use yazi_macro::impl_data_any;
use yazi_shared::{strand::ToStrand, url::UrlBuf}; use yazi_shared::{strand::ToStrand, url::UrlBuf};

View file

@ -7,11 +7,11 @@ pub enum PreviewWrap {
Yes, Yes,
} }
impl From<PreviewWrap> for Option<ratatui::widgets::Wrap> { impl From<PreviewWrap> for Option<ratatui_widgets::paragraph::Wrap> {
fn from(wrap: PreviewWrap) -> Self { fn from(wrap: PreviewWrap) -> Self {
match wrap { match wrap {
PreviewWrap::No => None, PreviewWrap::No => None,
PreviewWrap::Yes => Some(ratatui::widgets::Wrap { trim: false }), PreviewWrap::Yes => Some(ratatui_widgets::paragraph::Wrap { trim: false }),
} }
} }
} }
@ -20,7 +20,7 @@ impl From<PreviewWrap> for yazi_binding::elements::Wrap {
fn from(value: PreviewWrap) -> Self { fn from(value: PreviewWrap) -> Self {
Self(match value { Self(match value {
PreviewWrap::No => None, PreviewWrap::No => None,
PreviewWrap::Yes => Some(ratatui::widgets::Wrap { trim: false }), PreviewWrap::Yes => Some(ratatui_widgets::paragraph::Wrap { trim: false }),
}) })
} }
} }

View file

@ -34,20 +34,21 @@ yazi-watcher = { path = "../yazi-watcher", version = "26.5.6" }
yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" } yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }
dyn-clone = { workspace = true } dyn-clone = { workspace = true }
hashbrown = { workspace = true } hashbrown = { workspace = true }
indexmap = { workspace = true } indexmap = { workspace = true }
mlua = { workspace = true } mlua = { workspace = true }
parking_lot = { workspace = true } parking_lot = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
serde = { workspace = true } ratatui-widgets = { workspace = true }
serde_with = { workspace = true } serde = { workspace = true }
strum = { workspace = true } serde_with = { workspace = true }
syntect = { workspace = true } strum = { workspace = true }
tokio = { workspace = true } syntect = { workspace = true }
tokio-stream = { workspace = true } tokio = { workspace = true }
tokio-util = { workspace = true } tokio-stream = { workspace = true }
tracing = { workspace = true } tokio-util = { workspace = true }
unicode-width = { workspace = true } tracing = { workspace = true }
yazi-prebuilt = "0.1.0" unicode-width = { workspace = true }
yazi-prebuilt = "0.1.0"

View file

@ -1,4 +1,5 @@
use ratatui::{text::Line, widgets::Paragraph}; use ratatui_core::text::Line;
use ratatui_widgets::paragraph::Paragraph;
use yazi_binding::position::Position; use yazi_binding::position::Position;
use yazi_shared::CompletionToken; use yazi_shared::CompletionToken;

View file

@ -1,4 +1,4 @@
use ratatui::layout::{Margin, Position, Rect}; use ratatui_core::layout::{Margin, Position, Rect};
use yazi_shared::Layer; use yazi_shared::Layer;
use yazi_tty::sequence::SetCursorStyle; use yazi_tty::sequence::SetCursorStyle;

View file

@ -1,7 +1,7 @@
use std::{io::{BufRead, BufReader, Cursor, Seek}, path::PathBuf, sync::OnceLock}; use std::{io::{BufRead, BufReader, Cursor, Seek}, path::PathBuf, sync::OnceLock};
use anyhow::{Result, anyhow, bail}; use anyhow::{Result, anyhow, bail};
use ratatui::{layout::Size, text::{Line, Span, Text}}; use ratatui_core::{layout::Size, text::{Line, Span, Text}};
use syntect::{LoadingError, dumps, easy::HighlightLines, highlighting::{self, Theme, ThemeSet}, parsing::{SyntaxReference, SyntaxSet}}; use syntect::{LoadingError, dumps, easy::HighlightLines, highlighting::{self, Theme, ThemeSet}, parsing::{SyntaxReference, SyntaxSet}};
use yazi_config::{THEME, YAZI}; use yazi_config::{THEME, YAZI};
use yazi_runner::previewer::PeekError; use yazi_runner::previewer::PeekError;
@ -207,20 +207,20 @@ impl Highlighter {
impl Highlighter { impl Highlighter {
fn to_line_widget<'a>(regions: Vec<(highlighting::Style, &'a str)>) -> Line<'a> { fn to_line_widget<'a>(regions: Vec<(highlighting::Style, &'a str)>) -> Line<'a> {
Line::from_iter(regions.into_iter().map(|(style, s)| { Line::from_iter(regions.into_iter().map(|(style, s)| {
let mut modifier = ratatui::style::Modifier::empty(); let mut modifier = ratatui_core::style::Modifier::empty();
if style.font_style.contains(highlighting::FontStyle::BOLD) { if style.font_style.contains(highlighting::FontStyle::BOLD) {
modifier |= ratatui::style::Modifier::BOLD; modifier |= ratatui_core::style::Modifier::BOLD;
} }
if style.font_style.contains(highlighting::FontStyle::ITALIC) { if style.font_style.contains(highlighting::FontStyle::ITALIC) {
modifier |= ratatui::style::Modifier::ITALIC; modifier |= ratatui_core::style::Modifier::ITALIC;
} }
if style.font_style.contains(highlighting::FontStyle::UNDERLINE) { if style.font_style.contains(highlighting::FontStyle::UNDERLINE) {
modifier |= ratatui::style::Modifier::UNDERLINED; modifier |= ratatui_core::style::Modifier::UNDERLINED;
} }
Span { Span {
content: s.into(), content: s.into(),
style: ratatui::style::Style { style: ratatui_core::style::Style {
fg: Self::to_ansi_color(style.foreground), fg: Self::to_ansi_color(style.foreground),
// bg: Self::to_ansi_color(style.background), // bg: Self::to_ansi_color(style.background),
add_modifier: modifier, add_modifier: modifier,
@ -231,7 +231,7 @@ impl Highlighter {
} }
// Copied from https://github.com/sharkdp/bat/blob/master/src/terminal.rs // Copied from https://github.com/sharkdp/bat/blob/master/src/terminal.rs
fn to_ansi_color(color: highlighting::Color) -> Option<ratatui::style::Color> { fn to_ansi_color(color: highlighting::Color) -> Option<ratatui_core::style::Color> {
if color.a == 0 { if color.a == 0 {
// Themes can specify one of the user-configurable terminal colors by // Themes can specify one of the user-configurable terminal colors by
// encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set // encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set
@ -242,14 +242,14 @@ impl Highlighter {
// sequences using codes 30-37 (foreground) and 40-47 (background). // sequences using codes 30-37 (foreground) and 40-47 (background).
// For example, red foreground is \x1b[31m. This works on terminals // For example, red foreground is \x1b[31m. This works on terminals
// without 256-color support. // without 256-color support.
0x00 => ratatui::style::Color::Black, 0x00 => ratatui_core::style::Color::Black,
0x01 => ratatui::style::Color::Red, 0x01 => ratatui_core::style::Color::Red,
0x02 => ratatui::style::Color::Green, 0x02 => ratatui_core::style::Color::Green,
0x03 => ratatui::style::Color::Yellow, 0x03 => ratatui_core::style::Color::Yellow,
0x04 => ratatui::style::Color::Blue, 0x04 => ratatui_core::style::Color::Blue,
0x05 => ratatui::style::Color::Magenta, 0x05 => ratatui_core::style::Color::Magenta,
0x06 => ratatui::style::Color::Cyan, 0x06 => ratatui_core::style::Color::Cyan,
0x07 => ratatui::style::Color::White, 0x07 => ratatui_core::style::Color::White,
// For all other colors, use Fixed to produce escape sequences using // For all other colors, use Fixed to produce escape sequences using
// codes 38;5 (foreground) and 48;5 (background). For example, // codes 38;5 (foreground) and 48;5 (background). For example,
// bright red foreground is \x1b[38;5;9m. This only works on // bright red foreground is \x1b[38;5;9m. This only works on
@ -258,7 +258,7 @@ impl Highlighter {
// TODO: When ansi_term adds support for bright variants using codes // TODO: When ansi_term adds support for bright variants using codes
// 90-97 (foreground) and 100-107 (background), we should use those // 90-97 (foreground) and 100-107 (background), we should use those
// for values 0x08 to 0x0f and only use Fixed for 0x10 to 0xff. // for values 0x08 to 0x0f and only use Fixed for 0x10 to 0xff.
n => ratatui::style::Color::Indexed(n), n => ratatui_core::style::Color::Indexed(n),
}) })
} else if color.a == 1 { } else if color.a == 1 {
// Themes can specify the terminal's default foreground/background color // Themes can specify the terminal's default foreground/background color
@ -266,7 +266,7 @@ impl Highlighter {
// 01. The built-in theme ansi uses this. // 01. The built-in theme ansi uses this.
None None
} else { } else {
Some(ratatui::style::Color::Rgb(color.r, color.g, color.b)) Some(ratatui_core::style::Color::Rgb(color.r, color.g, color.b))
} }
} }
} }

View file

@ -1,6 +1,6 @@
use std::iter; use std::iter;
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use yazi_binding::position::{Origin, Position}; use yazi_binding::position::{Origin, Position};
use yazi_fs::Splatable; use yazi_fs::Splatable;
use yazi_shared::url::{AsUrl, Url, UrlBuf}; use yazi_shared::url::{AsUrl, Url, UrlBuf};

View file

@ -52,8 +52,8 @@ impl Message {
} }
pub fn height(&self, width: u16) -> usize { pub fn height(&self, width: u16) -> usize {
let lines = ratatui::widgets::Paragraph::new(self.content.as_str()) let lines = ratatui_widgets::paragraph::Paragraph::new(self.content.as_str())
.wrap(ratatui::widgets::Wrap { trim: false }) .wrap(ratatui_widgets::paragraph::Wrap { trim: false })
.line_count(width.saturating_sub(NOTIFY_BORDER)); .line_count(width.saturating_sub(NOTIFY_BORDER));
lines + NOTIFY_BORDER as usize lines + NOTIFY_BORDER as usize

View file

@ -1,6 +1,6 @@
use std::ops::ControlFlow; use std::ops::ControlFlow;
use ratatui::layout::{Constraint, Layout, Rect}; use ratatui_core::layout::{Constraint, Layout, Rect};
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use super::{Message, NOTIFY_SPACING}; use super::{Message, NOTIFY_SPACING};

View file

@ -1,7 +1,7 @@
use std::borrow::Cow; use std::borrow::Cow;
use anyhow::Result; use anyhow::Result;
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use yazi_binding::position::{Origin, Position}; use yazi_binding::position::{Origin, Position};
use yazi_config::LAYOUT; use yazi_config::LAYOUT;

View file

@ -20,9 +20,9 @@ yazi-term = { path = "../yazi-term", version = "26.5.6" }
yazi-tty = { path = "../yazi-tty", version = "26.5.9" } yazi-tty = { path = "../yazi-tty", version = "26.5.9" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }
either = { workspace = true } either = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
scopeguard = { workspace = true } scopeguard = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }

View file

@ -2,7 +2,7 @@ use std::{io::{self, BufWriter, Write}, time::Duration};
use anyhow::Result; use anyhow::Result;
use either::Either; use either::Either;
use ratatui::style::Color; use ratatui_core::style::Color;
use scopeguard::defer; use scopeguard::defer;
use tokio::time::sleep; use tokio::time::sleep;
use tracing::{debug, error, warn}; use tracing::{debug, error, warn};

View file

@ -46,7 +46,8 @@ better-panic = "0.3.0"
fdlimit = "0.3.0" fdlimit = "0.3.0"
mlua = { workspace = true } mlua = { workspace = true }
paste = { workspace = true } paste = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
ratatui-widgets = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }
tokio-stream = { workspace = true } tokio-stream = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }

View file

@ -1,6 +1,6 @@
use std::{io::Write, sync::atomic::{AtomicU8, Ordering}}; use std::{io::Write, sync::atomic::{AtomicU8, Ordering}};
use ratatui::layout::Position; use ratatui_core::layout::Position;
use yazi_macro::writef; use yazi_macro::writef;
use yazi_tty::{TTY, sequence::{BeginSyncUpdate, EndSyncUpdate, MoveTo, SetCursorStyle, ShowCursor}}; use yazi_tty::{TTY, sequence::{BeginSyncUpdate, EndSyncUpdate, MoveTo, SetCursorStyle, ShowCursor}};

View file

@ -1,6 +1,7 @@
use std::path::MAIN_SEPARATOR_STR; use std::path::MAIN_SEPARATOR_STR;
use ratatui::{buffer::Buffer, layout::Rect, widgets::{Block, BorderType, List, ListItem, Widget}}; use ratatui_core::{buffer::Buffer, layout::Rect, widgets::Widget};
use ratatui_widgets::{block::Block, borders::BorderType, list::{List, ListItem}};
use yazi_binding::position::{Offset, Position}; use yazi_binding::position::{Offset, Position};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{Margin, Rect}, style::Styled, widgets::{Block, Borders, Widget}}; use ratatui_core::{buffer::Buffer, layout::{Margin, Rect}, style::Styled, widgets::Widget};
use ratatui_widgets::{block::Block, borders::Borders};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;
@ -28,7 +29,7 @@ impl Widget for Body<'_> {
confirm confirm
.body .body
.clone() .clone()
.alignment(ratatui::layout::Alignment::Center) .alignment(ratatui_core::layout::Alignment::Center)
.block(block) .block(block)
.style(THEME.confirm.body.get().derive(Styled::style(&confirm.body))) .style(THEME.confirm.body.get().derive(Styled::style(&confirm.body)))
.render(inner, buf); .render(inner, buf);

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{Constraint, Rect}, text::Span, widgets::{Paragraph, Widget}}; use ratatui_core::{buffer::Buffer, layout::{Constraint, Rect}, text::Span, widgets::Widget};
use ratatui_widgets::paragraph::Paragraph;
use yazi_config::THEME; use yazi_config::THEME;
pub(crate) struct Buttons; pub(crate) struct Buttons;
@ -6,7 +7,8 @@ pub(crate) struct Buttons;
impl Widget for Buttons { impl Widget for Buttons {
fn render(self, area: Rect, buf: &mut Buffer) { fn render(self, area: Rect, buf: &mut Buffer) {
let chunks = let chunks =
ratatui::layout::Layout::horizontal([Constraint::Fill(1), Constraint::Fill(1)]).split(area); ratatui_core::layout::Layout::horizontal([Constraint::Fill(1), Constraint::Fill(1)])
.split(area);
let labels = THEME.confirm.btn_labels.load(); let labels = THEME.confirm.btn_labels.load();
Paragraph::new(Span::raw(&labels[0]).style(THEME.confirm.btn_yes.get())) Paragraph::new(Span::raw(&labels[0]).style(THEME.confirm.btn_yes.get()))

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{Alignment, Constraint, Layout, Margin, Rect}, widgets::{Block, BorderType, Widget}}; use ratatui_core::{buffer::Buffer, layout::{Alignment, Constraint, Layout, Margin, Rect}, widgets::Widget};
use ratatui_widgets::{block::Block, borders::BorderType};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{Margin, Rect}, widgets::{Block, Borders, Scrollbar, ScrollbarOrientation, ScrollbarState, StatefulWidget, Widget, Wrap}}; use ratatui_core::{buffer::Buffer, layout::{Margin, Rect}, widgets::{StatefulWidget, Widget}};
use ratatui_widgets::{block::Block, borders::Borders, paragraph::Wrap, scrollbar::{Scrollbar, ScrollbarOrientation, ScrollbarState}};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{self, Constraint, Rect}, widgets::{List, ListItem, Widget}}; use ratatui_core::{buffer::Buffer, layout::{self, Constraint, Rect}, widgets::Widget};
use ratatui_widgets::list::{List, ListItem};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,4 @@
use ratatui::{buffer::Buffer, layout::{self, Constraint, Rect}, text::Line, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::{self, Constraint, Rect}, text::Line, widgets::Widget};
use yazi_config::{KEYMAP, THEME}; use yazi_config::{KEYMAP, THEME};
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{Margin, Rect}, text::Line, widgets::{Block, BorderType, Widget}}; use ratatui_core::{buffer::Buffer, layout::{Margin, Rect}, text::Line, widgets::Widget};
use ratatui_widgets::{block::Block, borders::BorderType};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,7 +1,7 @@
use std::{fs::File, io}; use std::{fs::File, io};
use anyhow::Context; use anyhow::Context;
use ratatui::style::Color; use ratatui_core::style::Color;
use tracing_appender::non_blocking::WorkerGuard; use tracing_appender::non_blocking::WorkerGuard;
use tracing_subscriber::EnvFilter; use tracing_subscriber::EnvFilter;
use yazi_fs::Xdg; use yazi_fs::Xdg;

View file

@ -1,4 +1,4 @@
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::Rect, widgets::Widget};
use tracing::error; use tracing::error;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,4 @@
use ratatui::{buffer::Buffer, widgets::Widget}; use ratatui_core::{buffer::Buffer, widgets::Widget};
use yazi_binding::elements::Spatial; use yazi_binding::elements::Spatial;
use yazi_config::LAYOUT; use yazi_config::LAYOUT;
use yazi_core::Core; use yazi_core::Core;
@ -13,7 +13,7 @@ impl<'a> Preview<'a> {
} }
impl Widget for Preview<'_> { impl Widget for Preview<'_> {
fn render(self, win: ratatui::layout::Rect, buf: &mut Buffer) { fn render(self, win: ratatui_core::layout::Rect, buf: &mut Buffer) {
let Some(lock) = &self.core.active().preview.lock else { let Some(lock) = &self.core.active().preview.lock else {
return; return;
}; };

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{self, Constraint, Offset, Rect}, widgets::{Block, BorderType, Paragraph, Widget, Wrap}}; use ratatui_core::{buffer::Buffer, layout::{self, Constraint, Offset, Rect}, widgets::Widget};
use ratatui_widgets::{block::Block, borders::BorderType, paragraph::{Paragraph, Wrap}};
use yazi_core::{Core, notify::Message}; use yazi_core::{Core, notify::Message};
pub(crate) struct Notify<'a> { pub(crate) struct Notify<'a> {

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{Margin, Rect}, widgets::{ListItem, Scrollbar, ScrollbarOrientation, ScrollbarState, StatefulWidget, Widget}}; use ratatui_core::{buffer::Buffer, layout::{Margin, Rect}, widgets::{StatefulWidget, Widget}};
use ratatui_widgets::{list::ListItem, scrollbar::{Scrollbar, ScrollbarOrientation, ScrollbarState}};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;
use yazi_widgets::Scrollable; use yazi_widgets::Scrollable;
@ -33,6 +34,6 @@ impl Widget for List<'_> {
ListItem::new(format!(" {v}")).style(THEME.pick.inactive.get()) ListItem::new(format!(" {v}")).style(THEME.pick.inactive.get())
} }
}); });
Widget::render(ratatui::widgets::List::new(items), inner, buf); Widget::render(ratatui_widgets::list::List::new(items), inner, buf);
} }
} }

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{Margin, Rect}, widgets::{Block, BorderType, Widget}}; use ratatui_core::{buffer::Buffer, layout::{Margin, Rect}, widgets::Widget};
use ratatui_widgets::{block::Block, borders::BorderType};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,5 +1,5 @@
use mlua::{ObjectLike, Table}; use mlua::{ObjectLike, Table};
use ratatui::{buffer::Buffer, layout::Rect}; use ratatui_core::{buffer::Buffer, layout::Rect};
use yazi_core::Core; use yazi_core::Core;
use yazi_plugin::LUA; use yazi_plugin::LUA;
use yazi_widgets::{Renderable, Renderables}; use yazi_widgets::{Renderable, Renderables};

View file

@ -1,5 +1,5 @@
use mlua::{ObjectLike, Table}; use mlua::{ObjectLike, Table};
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::Rect, widgets::Widget};
use tracing::error; use tracing::error;
use yazi_core::Core; use yazi_core::Core;
use yazi_plugin::LUA; use yazi_plugin::LUA;

View file

@ -1,4 +1,4 @@
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::Rect, widgets::Widget};
use yazi_binding::elements::Spatial; use yazi_binding::elements::Spatial;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,4 @@
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::Rect, widgets::Widget};
use tracing::error; use tracing::error;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,4 @@
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::Rect, widgets::Widget};
use tracing::error; use tracing::error;
use yazi_config::LAYOUT; use yazi_config::LAYOUT;
use yazi_core::Core; use yazi_core::Core;

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout::{self, Alignment, Constraint, Rect}, text::Line, widgets::{Block, BorderType, Widget}}; use ratatui_core::{buffer::Buffer, layout::{self, Alignment, Constraint, Rect}, text::Line, widgets::Widget};
use ratatui_widgets::{block::Block, borders::BorderType};
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::{Core, tasks::TASKS_PERCENT}; use yazi_core::{Core, tasks::TASKS_PERCENT};

View file

@ -1,4 +1,4 @@
use ratatui::{buffer::Buffer, layout::Rect, text::{Line, Span}, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::Rect, text::{Line, Span}, widgets::Widget};
use yazi_config::{THEME, keymap::Chord}; use yazi_config::{THEME, keymap::Chord};
pub(super) struct Cand<'a> { pub(super) struct Cand<'a> {

View file

@ -1,4 +1,5 @@
use ratatui::{buffer::Buffer, layout, layout::{Constraint, Rect}, widgets::{Block, Widget}}; use ratatui_core::{buffer::Buffer, layout, layout::{Constraint, Rect}, widgets::Widget};
use ratatui_widgets::block::Block;
use yazi_config::THEME; use yazi_config::THEME;
use yazi_core::Core; use yazi_core::Core;

View file

@ -17,7 +17,6 @@ default = [ "vendored-lua" ]
vendored-lua = [ "mlua/vendored" ] vendored-lua = [ "mlua/vendored" ]
[dependencies] [dependencies]
yazi-binding = { path = "../yazi-binding", version = "26.5.6" }
yazi-boot = { path = "../yazi-boot", version = "26.5.6" } yazi-boot = { path = "../yazi-boot", version = "26.5.6" }
yazi-config = { path = "../yazi-config", version = "26.5.6" } yazi-config = { path = "../yazi-config", version = "26.5.6" }
yazi-core = { path = "../yazi-core", version = "26.5.6" } yazi-core = { path = "../yazi-core", version = "26.5.6" }
@ -32,13 +31,13 @@ yazi-vfs = { path = "../yazi-vfs", version = "26.5.6" }
yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" } yazi-widgets = { path = "../yazi-widgets", version = "26.5.6" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }
bitflags = { workspace = true } bitflags = { workspace = true }
hashbrown = { workspace = true } hashbrown = { workspace = true }
mlua = { workspace = true } mlua = { workspace = true }
paste = { workspace = true } paste = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
serde_with = { workspace = true } serde_with = { workspace = true }
strum = { workspace = true } strum = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }

View file

@ -1,5 +1,5 @@
use mlua::{ExternalError, FromLua, IntoLua, Lua, Table, Value}; use mlua::{ExternalError, FromLua, IntoLua, Lua, Table, Value};
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
#[derive(Debug)] #[derive(Debug)]
pub struct ReflowForm { pub struct ReflowForm {

View file

@ -44,7 +44,8 @@ futures = { workspace = true }
inventory = { workspace = true } inventory = { workspace = true }
mlua = { workspace = true } mlua = { workspace = true }
percent-encoding = { workspace = true } percent-encoding = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
ratatui-widgets = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }
tokio-stream = { workspace = true } tokio-stream = { workspace = true }

View file

@ -14,19 +14,19 @@ impl Utils {
let mut table = yazi_binding::elements::Table::try_from(&table)?; let mut table = yazi_binding::elements::Table::try_from(&table)?;
let area = table.area(); let area = table.area();
table.set_area(area.inner(ratatui::widgets::Padding::uniform(1))); table.set_area(area.inner(ratatui_widgets::block::Padding::uniform(1)));
lock.data = vec![ lock.data = vec![
Renderable::Clear(Default::default()).with_area(area), Renderable::Clear(Default::default()).with_area(area),
Renderable::Border(yazi_binding::elements::Border { Renderable::Border(yazi_binding::elements::Border {
area, area,
edge: Edge(ratatui::widgets::Borders::ALL), edge: Edge(ratatui_widgets::borders::Borders::ALL),
r#type: ratatui::widgets::BorderType::Rounded, r#type: ratatui_widgets::borders::BorderType::Rounded,
style: THEME.spot.border.get().into(), style: THEME.spot.border.get().into(),
merge: Default::default(), merge: Default::default(),
titles: vec![( titles: vec![(
ratatui::widgets::TitlePosition::Top, ratatui_widgets::block::TitlePosition::Top,
ratatui::text::Line::raw("Spot").centered().style(THEME.spot.title.get()), ratatui_core::text::Line::raw("Spot").centered().style(THEME.spot.title.get()),
)], )],
}), }),
Renderable::Table(Box::new(table)), Renderable::Table(Box::new(table)),

View file

@ -26,7 +26,8 @@ base64 = { workspace = true }
hashbrown = { workspace = true } hashbrown = { workspace = true }
mlua = { workspace = true } mlua = { workspace = true }
percent-encoding = { workspace = true } percent-encoding = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
ratatui-widgets = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
thiserror = { workspace = true } thiserror = { workspace = true }
toml = { workspace = true } toml = { workspace = true }

View file

@ -1,6 +1,7 @@
use std::{boxed::Box, iter, slice::Iter, str::{self, Lines}}; use std::{boxed::Box, iter, slice::Iter, str::{self, Lines}};
use ratatui::{layout::Alignment, style::Style, text::Line, widgets::Wrap}; use ratatui_core::{layout::Alignment, style::Style, text::Line};
use ratatui_widgets::paragraph::Wrap;
use super::wrapper::{LineComposer, WordWrapper}; use super::wrapper::{LineComposer, WordWrapper};
use crate::ratatui::SpanIter; use crate::ratatui::SpanIter;

View file

@ -1,6 +1,6 @@
use std::slice::Iter; use std::slice::Iter;
use ratatui::{style::Style, text::{Line, Span, StyledGrapheme}}; use ratatui_core::{style::Style, text::{Line, Span, StyledGrapheme}};
use unicode_segmentation::{Graphemes, UnicodeSegmentation}; use unicode_segmentation::{Graphemes, UnicodeSegmentation};
#[allow(private_interfaces)] #[allow(private_interfaces)]

View file

@ -1,7 +1,7 @@
// Copied from https://github.com/ratatui/ratatui/blob/main/ratatui-widgets/src/reflow.rs // Copied from https://github.com/ratatui/ratatui/blob/main/ratatui-widgets/src/reflow.rs
use std::{collections::VecDeque, mem}; use std::{collections::VecDeque, mem};
use ratatui::{layout::Alignment, text::StyledGrapheme}; use ratatui_core::{layout::Alignment, text::StyledGrapheme};
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
pub trait LineComposer<'a> { pub trait LineComposer<'a> {

View file

@ -18,12 +18,12 @@ yazi-macro = { path = "../yazi-macro", version = "26.5.6" }
yazi-shim = { path = "../yazi-shim", version = "26.5.6" } yazi-shim = { path = "../yazi-shim", version = "26.5.6" }
# External dependencies # External dependencies
base64 = { workspace = true } base64 = { workspace = true }
bitflags = { workspace = true } bitflags = { workspace = true }
mlua = { workspace = true } mlua = { workspace = true }
parking_lot = { workspace = true } parking_lot = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }
[target."cfg(unix)".dependencies] [target."cfg(unix)".dependencies]
libc = { workspace = true } libc = { workspace = true }

View file

@ -1,6 +1,6 @@
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use ratatui::backend::ClearType; use ratatui_core::backend::ClearType;
/// Erase entire display /// Erase entire display
pub struct EraseScreen; pub struct EraseScreen;

View file

@ -1,6 +1,6 @@
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use ratatui::style::Color; use ratatui_core::style::Color;
/// Set foreground color from a `Color`. /// Set foreground color from a `Color`.
pub struct SetFg(pub Color); pub struct SetFg(pub Color);

View file

@ -22,6 +22,6 @@ yazi-term = { path = "../yazi-term", version = "26.5.6" }
yazi-tty = { path = "../yazi-tty", version = "26.5.9" } yazi-tty = { path = "../yazi-tty", version = "26.5.9" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }

View file

@ -1,6 +1,6 @@
use std::{io::{self, Write}, ops::{Deref, DerefMut}}; use std::{io::{self, Write}, ops::{Deref, DerefMut}};
use ratatui::{backend::{Backend, ClearType, WindowSize}, buffer::Cell, layout::{Position, Size}, style::{Color, Modifier}}; use ratatui_core::{backend::{Backend, ClearType, WindowSize}, buffer::Cell, layout::{Position, Size}, style::{Color, Modifier}};
use yazi_macro::writef; use yazi_macro::writef;
use yazi_term::TERM; use yazi_term::TERM;
use yazi_tty::sequence::{EraseRegion, HideCursor, MoveTo, ResetAttrs, SetBg, SetFg, SetSgr, SetUnderlineColor, ShowCursor}; use yazi_tty::sequence::{EraseRegion, HideCursor, MoveTo, ResetAttrs, SetBg, SetFg, SetSgr, SetUnderlineColor, ShowCursor};

View file

@ -1,7 +1,7 @@
use std::{io::{self, Write}, ops::Deref}; use std::{io::{self, Write}, ops::Deref};
use anyhow::Result; use anyhow::Result;
use ratatui::{CompletedFrame, Frame, Terminal, buffer::Buffer, layout::Rect}; use ratatui_core::{buffer::Buffer, layout::Rect, terminal::{CompletedFrame, Frame, Terminal}};
use yazi_config::YAZI; use yazi_config::YAZI;
use yazi_emulator::{Emulator, Mux, TMUX}; use yazi_emulator::{Emulator, Mux, TMUX};
use yazi_macro::writef; use yazi_macro::writef;

View file

@ -25,19 +25,20 @@ yazi-term = { path = "../yazi-term", version = "26.5.6" }
yazi-tty = { path = "../yazi-tty", version = "26.5.9" } yazi-tty = { path = "../yazi-tty", version = "26.5.9" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }
dyn-clone = { workspace = true } dyn-clone = { workspace = true }
futures = { workspace = true } futures = { workspace = true }
inventory = { workspace = true } inventory = { workspace = true }
mlua = { workspace = true } mlua = { workspace = true }
parking_lot = { workspace = true } parking_lot = { workspace = true }
ratatui = { workspace = true } ratatui-core = { workspace = true }
serde = { workspace = true } ratatui-widgets = { workspace = true }
strum = { workspace = true } serde = { workspace = true }
tokio = { workspace = true } strum = { workspace = true }
tokio-stream = { workspace = true } tokio = { workspace = true }
tracing = { workspace = true } tokio-stream = { workspace = true }
unicode-width = { workspace = true } tracing = { workspace = true }
unicode-width = { workspace = true }
[target."cfg(windows)".dependencies] [target."cfg(windows)".dependencies]
clipboard-win = "5.4.1" clipboard-win = "5.4.1"

View file

@ -1,5 +1,5 @@
use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use ratatui::{buffer::{Buffer, CellDiffOption}, layout::Rect, widgets::Widget}; use ratatui_core::{buffer::{Buffer, CellDiffOption}, layout::Rect, widgets::Widget};
use yazi_binding::{elements::{Area, Spatial}, impl_area_method}; use yazi_binding::{elements::{Area, Spatial}, impl_area_method};
use crate::clear::ClearInventory; use crate::clear::ClearInventory;
@ -37,7 +37,7 @@ impl Widget for Clear {
where where
Self: Sized, Self: Sized,
{ {
ratatui::widgets::Clear.render(area, buf); ratatui_widgets::clear::Clear.render(area, buf);
for inv in inventory::iter::<ClearInventory> { for inv in inventory::iter::<ClearInventory> {
if let Some(overlap) = (inv.clear)(area) { if let Some(overlap) = (inv.clear)(area) {

View file

@ -1,4 +1,4 @@
use ratatui::layout::Rect; use ratatui_core::layout::Rect;
pub struct ClearInventory { pub struct ClearInventory {
pub clear: fn(Rect) -> Option<Rect>, pub clear: fn(Rect) -> Option<Rect>,

View file

@ -2,7 +2,7 @@ use std::sync::Arc;
use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value}; use mlua::{AnyUserData, IntoLua, Lua, MetaMethod, Table, UserData, UserDataMethods, Value};
use parking_lot::Mutex; use parking_lot::Mutex;
use ratatui::widgets::Widget; use ratatui_core::widgets::Widget;
use yazi_binding::{elements::{Area, Spatial}, impl_area_method, position::{Offset, Origin, Position}}; use yazi_binding::{elements::{Area, Spatial}, impl_area_method, position::{Offset, Origin, Position}};
use crate::input::{Input, InputOpt, InputStyles}; use crate::input::{Input, InputOpt, InputStyles};
@ -66,7 +66,7 @@ impl Spatial for InputArc {
} }
impl Widget for &InputArc { impl Widget for &InputArc {
fn render(self, rect: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) fn render(self, rect: ratatui_core::layout::Rect, buf: &mut ratatui_core::buffer::Buffer)
where where
Self: Sized, Self: Sized,
{ {

View file

@ -1,5 +1,5 @@
use mlua::{ExternalError, FromLua, Lua, Table, Value}; use mlua::{ExternalError, FromLua, Lua, Table, Value};
use ratatui::style::Style; use ratatui_core::style::Style;
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
pub struct InputStyles { pub struct InputStyles {

View file

@ -1,6 +1,6 @@
use std::ops::Range; use std::ops::Range;
use ratatui::{buffer::Buffer, layout::Rect, text::Line, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::Rect, text::Line, widgets::Widget};
use super::Input; use super::Input;

Some files were not shown because too many files have changed in this diff Show more