Skip to content

Commit

Permalink
deps(iocraft): Update to v0.6. (#120)
Browse files Browse the repository at this point in the history
* Update deps.

* Dont error.
  • Loading branch information
milesj authored Jan 6, 2025
1 parent 3199931 commit b653810
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 57 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ resolver = "2"
members = ["crates/*", "examples/*"]

[workspace.dependencies]
async-trait = "0.1.83"
async-trait = "0.1.84"
crossterm = "0.28.1"
dirs = "5.0.1"
iocraft = "0.5.3"
iocraft = "0.6.0"
# iocraft = { git = "https://github.com/ccbrown/iocraft", branch = "main" }
miette = "7.4.0"
regex = { version = "1.11.1", default-features = false }
relative-path = "1.9.3"
reqwest = { version = "0.12.10", default-features = false }
reqwest = { version = "0.12.12", default-features = false }
rustc-hash = "2.1.0"
serial_test = "3.2.0"
serde = { version = "1.0.216", features = ["derive"] }
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.134"
serde_yaml = "0.9.34"
thiserror = "2.0.9"
Expand Down
6 changes: 3 additions & 3 deletions crates/console/src/components/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ pub fn Confirm<'a>(props: &mut ConfirmProps<'a>, mut hooks: Hooks) -> impl Into<
}.into_any()
})
) {
Box(margin_top: 1, margin_bottom: 1, gap: 1) {
View(margin_top: 1, margin_bottom: 1, gap: 1) {
Button(
has_focus: focused == 0,
handler: move |_| {
handle_confirm_via_focus();
}
) {
Box(
View(
padding_left: 1,
padding_right: 1,
background_color: if focused == 0 {
Expand All @@ -143,7 +143,7 @@ pub fn Confirm<'a>(props: &mut ConfirmProps<'a>, mut hooks: Hooks) -> impl Into<
handle_confirm_via_focus();
}
) {
Box(
View(
padding_left: 1,
padding_right: 1,
background_color: if focused == 1 {
Expand Down
12 changes: 6 additions & 6 deletions crates/console/src/components/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ pub fn Entry<'a>(props: &mut EntryProps<'a>, hooks: Hooks) -> impl Into<AnyEleme

element! {
Stack {
Box {
Box(margin_right: 1) {
View {
View(margin_right: 1) {
Text(content: &props.name)
Separator(value: props.separator.as_deref().unwrap_or(":"))
}

#(if props.value.is_some() {
Some(element! {
Box {
View {
#(&mut props.value)
}
})
} else if let Some(content) = &props.content {
Some(element! {
Box {
View {
StyledText(content, style: Style::MutedLight)
}
})
} else if no_children {
Some(element! {
Box {
View {
StyledText(
content: props.fallback.as_deref()
.unwrap_or(&theme.layout_fallback_symbol),
Expand All @@ -58,7 +58,7 @@ pub fn Entry<'a>(props: &mut EntryProps<'a>, hooks: Hooks) -> impl Into<AnyEleme
None
} else {
Some(element! {
Box(flex_direction: FlexDirection::Column, padding_left: 2) {
View(flex_direction: FlexDirection::Column, padding_left: 2) {
#(&mut props.children)
}
})
Expand Down
4 changes: 2 additions & 2 deletions crates/console/src/components/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ pub fn Input<'a>(props: &mut InputProps<'a>, mut hooks: Hooks) -> impl Into<AnyE
error: Some(error),
) {
Group(gap: 1) {
Box {
View {
Text(
content: props.prefix_symbol.as_ref().unwrap_or(&theme.input_prefix_symbol),
color: theme.input_prefix_color,
)
}
Box(width: 50) {
View(width: 50) {
TextInput(
has_focus: true,
value: value.to_string(),
Expand Down
4 changes: 2 additions & 2 deletions crates/console/src/components/input_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn InputField<'a>(props: &mut InputFieldProps<'a>, hooks: Hooks) -> impl Int
let theme = hooks.use_context::<ConsoleTheme>();

element! {
Box(
View(
flex_direction: FlexDirection::Column,
border_color: if props.has_focus {
theme.border_focus_color
Expand Down Expand Up @@ -47,7 +47,7 @@ pub fn InputField<'a>(props: &mut InputFieldProps<'a>, hooks: Hooks) -> impl Int
}
}))

Box(width: Size::Percent(100.0)) {
View(width: Size::Percent(100.0)) {
#(&mut props.children)
}

Expand Down
13 changes: 5 additions & 8 deletions crates/console/src/components/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ pub fn Container<'a>(
) -> impl Into<AnyElement<'a>> {
let (mut width, _) = hooks.use_terminal_size();

// Non-TTY's like CI environments
if width == 0 {
if cfg!(debug_assertions) {
width = 60;
} else {
panic!("Terminal width is zero, unable to render container!");
}
width = 60;
}

element! {
Box(
View(
flex_direction: FlexDirection::Column,
width,
) {
Expand All @@ -41,7 +38,7 @@ pub struct StackProps<'a> {
#[component]
pub fn Stack<'a>(props: &mut StackProps<'a>) -> impl Into<AnyElement<'a>> {
element! {
Box(
View(
flex_direction: FlexDirection::Column,
gap: props.gap,
) {
Expand All @@ -59,7 +56,7 @@ pub struct GroupProps<'a> {
#[component]
pub fn Group<'a>(props: &mut GroupProps<'a>) -> impl Into<AnyElement<'a>> {
element! {
Box(
View(
flex_direction: FlexDirection::Row,
gap: props.gap,
) {
Expand Down
2 changes: 1 addition & 1 deletion crates/console/src/components/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn MapItem<'a>(props: &mut MapItemProps<'a>, hooks: Hooks) -> impl Into<AnyE

element! {
Group(gap: 1) {
Box {
View {
#(&mut props.name)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/console/src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub use styled_text::*;
pub use table::*;

// Re-export iocraft components
pub use iocraft::prelude::{Box as View, Button, Text};
pub use iocraft::prelude::{Button, Text, View};

use std::ops::Deref;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion crates/console/src/components/notice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn Notice<'a>(props: &mut NoticeProps<'a>, hooks: Hooks) -> impl Into<AnyEle
.or_else(|| Some(theme.border_color));

element! {
Box(
View(
flex_direction: FlexDirection::Column,
border_color: color,
border_edges: Edges::Left,
Expand Down
14 changes: 7 additions & 7 deletions crates/console/src/components/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ pub fn Progress<'a>(props: &mut ProgressProps, mut hooks: Hooks) -> impl Into<An
if should_exit.get() {
system.exit();

return element!(Box).into_any();
return element!(View).into_any();
}

match display.get() {
Expand All @@ -255,8 +255,8 @@ pub fn Progress<'a>(props: &mut ProgressProps, mut hooks: Hooks) -> impl Into<An
}

element! {
Box {
Box(width: Size::Length(props.bar_width), margin_right: 1) {
View {
View(width: Size::Length(props.bar_width), margin_right: 1) {
Text(
content: String::from(char_filled).repeat(bar_filled_width as usize),
color: bar_color,
Expand All @@ -278,7 +278,7 @@ pub fn Progress<'a>(props: &mut ProgressProps, mut hooks: Hooks) -> impl Into<An
color: bar_color,
)
}
Box {
View {
StyledText(
content: format!(
"{prefix}{}{suffix}",
Expand All @@ -297,14 +297,14 @@ pub fn Progress<'a>(props: &mut ProgressProps, mut hooks: Hooks) -> impl Into<An
.into_any()
}
ProgressDisplay::Loader => element! {
Box {
Box(margin_right: 1) {
View {
View(margin_right: 1) {
Text(
content: &frames.read()[frame_index.get()],
color: props.color.unwrap_or(theme.progress_loader_color),
)
}
Box {
View {
StyledText(
content: format!(
"{prefix}{}{suffix}",
Expand Down
8 changes: 4 additions & 4 deletions crates/console/src/components/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ pub fn Section<'a>(props: &mut SectionProps<'a>, hooks: Hooks) -> impl Into<AnyE
let theme = hooks.use_context::<ConsoleTheme>();

element! {
Box(
View(
flex_direction: FlexDirection::Column,
width: Size::Percent(100.0),
) {
Box(
View(
flex_direction: FlexDirection::Row,
border_color: theme.border_color,
border_edges: Edges::Top,
border_style: BorderStyle::Round,
width: Size::Percent(40.0)
) {
Box(margin_top: -1) {
View(margin_top: -1) {
Text(
content: format!("{} ", props.title),
color: if theme.supports_color {
Expand All @@ -44,7 +44,7 @@ pub fn Section<'a>(props: &mut SectionProps<'a>, hooks: Hooks) -> impl Into<AnyE
None
} else {
Some(element! {
Box(
View(
flex_direction: FlexDirection::Column,
padding_top: 1,
padding_left: 2,
Expand Down
2 changes: 1 addition & 1 deletion crates/console/src/components/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub fn Select<'a>(props: &mut SelectProps<'a>, mut hooks: Hooks) -> impl Into<An
}.into_any()
})
) {
Box(flex_direction: FlexDirection::Column, margin_top: 1, margin_bottom: 1) {
View(flex_direction: FlexDirection::Column, margin_top: 1, margin_bottom: 1) {
#(options.read().iter().enumerate().map(|(index, opt)| {
let active = active_index.get() == index;
let selected = selected_index.read().contains(&index);
Expand Down
2 changes: 1 addition & 1 deletion crates/console/src/components/styled_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn StyledText<'a>(props: &StyledTextProps, hooks: Hooks) -> impl Into<AnyEle
let parts = parse_tags(&props.content);

element! {
Box {
View {
#(parts.into_iter().map(|(text, tag)| {
element! {
Text(
Expand Down
8 changes: 4 additions & 4 deletions crates/console/src/components/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ pub fn Table<'a>(props: &mut TableProps<'a>, hooks: Hooks) -> impl Into<AnyEleme

element! {
ContextProvider(value: Context::owned(context)) {
Box(
View(
border_color: theme.border_color,
border_style: BorderStyle::Round,
flex_direction: FlexDirection::Column,
width: Size::Auto,
) {
Box(
View(
border_edges: Edges::Bottom,
border_color: theme.border_color,
border_style: BorderStyle::Round,
Expand Down Expand Up @@ -99,7 +99,7 @@ pub fn TableRow<'a>(props: &mut TableRowProps<'a>, hooks: Hooks) -> impl Into<An
let theme = hooks.use_context::<ConsoleTheme>();

element! {
Box(
View(
background_color: if props.row % 2 == 0 {
None
} else {
Expand Down Expand Up @@ -127,7 +127,7 @@ pub fn TableCol<'a>(props: &mut TableColProps<'a>, hooks: Hooks) -> impl Into<An
.unwrap_or_else(|| panic!("Unknown column index {}", props.col));

element! {
Box(
View(
justify_content: align_to_justify(attrs.align),
width: attrs.width,
) {
Expand Down

0 comments on commit b653810

Please sign in to comment.