Switch outdated tui crate for ratatui (#1671)
* Switch outdated tui crate for ratatui * fix query docs whoops
This commit is contained in:
1 parent
b4fe3829d1
commit
e0fbed7eea
6 files changed
+14
-14
No files matched your search
@@ -14,7 +14,7 @@ dioxus-html = { workspace = true }
|
|||||||
dioxus-native-core = { workspace = true, features = ["layout-attributes"] }
|
dioxus-native-core = { workspace = true, features = ["layout-attributes"] }
|
||||||
dioxus-native-core-macro = { workspace = true }
|
dioxus-native-core-macro = { workspace = true }
|
||||||
|
|
||||||
tui = "0.17.0"
|
ratatui = "0.24.0"
|
||||||
crossterm = "0.26.1"
|
crossterm = "0.26.1"
|
||||||
anyhow = "1.0.42"
|
anyhow = "1.0.42"
|
||||||
tokio = { workspace = true, features = ["full"] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use futures::{channel::mpsc::UnboundedSender, pin_mut, Future, StreamExt};
|
|||||||
use futures_channel::mpsc::unbounded;
|
use futures_channel::mpsc::unbounded;
|
||||||
use layout::TaffyLayout;
|
use layout::TaffyLayout;
|
||||||
use prevent_default::PreventDefault;
|
use prevent_default::PreventDefault;
|
||||||
|
use ratatui::{backend::CrosstermBackend, Terminal};
|
||||||
use std::{io, time::Duration};
|
use std::{io, time::Duration};
|
||||||
use std::{
|
use std::{
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
@@ -26,7 +27,6 @@ use std::{rc::Rc, sync::RwLock};
|
|||||||
use style_attributes::StyleModifier;
|
use style_attributes::StyleModifier;
|
||||||
pub use taffy::{geometry::Point, prelude::*};
|
pub use taffy::{geometry::Point, prelude::*};
|
||||||
use tokio::select;
|
use tokio::select;
|
||||||
use tui::{backend::CrosstermBackend, Terminal};
|
|
||||||
use widgets::{register_widgets, RinkWidgetResponder, RinkWidgetTraitObject};
|
use widgets::{register_widgets, RinkWidgetResponder, RinkWidgetTraitObject};
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
@@ -180,7 +180,7 @@ pub fn render<R: Driver>(
|
|||||||
|
|
||||||
if !to_rerender.is_empty() || updated {
|
if !to_rerender.is_empty() || updated {
|
||||||
updated = false;
|
updated = false;
|
||||||
fn resize(dims: tui::layout::Rect, taffy: &mut Taffy, rdom: &RealDom) {
|
fn resize(dims: ratatui::layout::Rect, taffy: &mut Taffy, rdom: &RealDom) {
|
||||||
let width = screen_to_layout_space(dims.width);
|
let width = screen_to_layout_space(dims.width);
|
||||||
let height = screen_to_layout_space(dims.height);
|
let height = screen_to_layout_space(dims.height);
|
||||||
let root_node = rdom
|
let root_node = rdom
|
||||||
@@ -222,7 +222,7 @@ pub fn render<R: Driver>(
|
|||||||
} else {
|
} else {
|
||||||
let rdom = rdom.read().unwrap();
|
let rdom = rdom.read().unwrap();
|
||||||
resize(
|
resize(
|
||||||
tui::layout::Rect {
|
ratatui::layout::Rect {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: 1000,
|
width: 1000,
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
use dioxus_native_core::{prelude::*, tree::TreeRef};
|
use dioxus_native_core::{prelude::*, tree::TreeRef};
|
||||||
use std::io::Stdout;
|
use ratatui::{layout::Rect, style::Color};
|
||||||
use taffy::{
|
use taffy::{
|
||||||
geometry::Point,
|
geometry::Point,
|
||||||
prelude::{Dimension, Layout, Size},
|
prelude::{Dimension, Layout, Size},
|
||||||
Taffy,
|
Taffy,
|
||||||
};
|
};
|
||||||
use tui::{backend::CrosstermBackend, layout::Rect, style::Color};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
focus::Focused,
|
focus::Focused,
|
||||||
@@ -20,7 +19,7 @@ use crate::{
|
|||||||
const RADIUS_MULTIPLIER: [f32; 2] = [1.0, 0.5];
|
const RADIUS_MULTIPLIER: [f32; 2] = [1.0, 0.5];
|
||||||
|
|
||||||
pub(crate) fn render_vnode(
|
pub(crate) fn render_vnode(
|
||||||
frame: &mut tui::Frame<CrosstermBackend<Stdout>>,
|
frame: &mut ratatui::Frame,
|
||||||
layout: &Taffy,
|
layout: &Taffy,
|
||||||
node: NodeRef,
|
node: NodeRef,
|
||||||
cfg: Config,
|
cfg: Config,
|
||||||
@@ -96,7 +95,7 @@ pub(crate) fn render_vnode(
|
|||||||
|
|
||||||
impl RinkWidget for NodeRef<'_> {
|
impl RinkWidget for NodeRef<'_> {
|
||||||
fn render(self, area: Rect, mut buf: RinkBuffer<'_>) {
|
fn render(self, area: Rect, mut buf: RinkBuffer<'_>) {
|
||||||
use tui::symbols::line::*;
|
use ratatui::symbols::line::*;
|
||||||
|
|
||||||
enum Direction {
|
enum Direction {
|
||||||
Left,
|
Left,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{num::ParseFloatError, str::FromStr};
|
use std::{num::ParseFloatError, str::FromStr};
|
||||||
|
|
||||||
use tui::style::{Color, Modifier, Style};
|
use ratatui::style::{Color, Modifier, Style};
|
||||||
|
|
||||||
use crate::RenderingMode;
|
use crate::RenderingMode;
|
||||||
|
|
||||||
@@ -442,6 +442,7 @@ impl RinkStyle {
|
|||||||
impl From<RinkStyle> for Style {
|
impl From<RinkStyle> for Style {
|
||||||
fn from(val: RinkStyle) -> Self {
|
fn from(val: RinkStyle) -> Self {
|
||||||
Style {
|
Style {
|
||||||
|
underline_color: None,
|
||||||
fg: val.fg.map(|c| c.color),
|
fg: val.fg.map(|c| c.color),
|
||||||
bg: val.bg.map(|c| c.color),
|
bg: val.bg.map(|c| c.color),
|
||||||
add_modifier: val.add_modifier,
|
add_modifier: val.add_modifier,
|
||||||
|
|||||||
@@ -187,8 +187,8 @@ pub enum BorderStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BorderStyle {
|
impl BorderStyle {
|
||||||
pub fn symbol_set(&self) -> Option<tui::symbols::line::Set> {
|
pub fn symbol_set(&self) -> Option<ratatui::symbols::line::Set> {
|
||||||
use tui::symbols::line::*;
|
use ratatui::symbols::line::*;
|
||||||
const DASHED: Set = Set {
|
const DASHED: Set = Set {
|
||||||
horizontal: "╌",
|
horizontal: "╌",
|
||||||
vertical: "╎",
|
vertical: "╎",
|
||||||
@@ -570,7 +570,7 @@ fn apply_animation(name: &str, _value: &str, _style: &mut StyleModifier) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn apply_font(name: &str, value: &str, style: &mut StyleModifier) {
|
fn apply_font(name: &str, value: &str, style: &mut StyleModifier) {
|
||||||
use tui::style::Modifier;
|
use ratatui::style::Modifier;
|
||||||
match name {
|
match name {
|
||||||
"font" => (),
|
"font" => (),
|
||||||
"font-family" => (),
|
"font-family" => (),
|
||||||
@@ -593,7 +593,7 @@ fn apply_font(name: &str, value: &str, style: &mut StyleModifier) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn apply_text(name: &str, value: &str, style: &mut StyleModifier) {
|
fn apply_text(name: &str, value: &str, style: &mut StyleModifier) {
|
||||||
use tui::style::Modifier;
|
use ratatui::style::Modifier;
|
||||||
|
|
||||||
match name {
|
match name {
|
||||||
"text-align" => todo!(),
|
"text-align" => todo!(),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use tui::{
|
use ratatui::{
|
||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::{Color, Modifier},
|
style::{Color, Modifier},
|
||||||
|
|||||||
Reference in new issue
Block a user