Skip to content

Commit c979618

Browse files
authored
Merge pull request #133 from togglebyte/dev
Dev
2 parents d989f5c + 2d03bbc commit c979618

32 files changed

Lines changed: 128 additions & 57 deletions

File tree

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
* 0.2.9
2+
* New function: truncate
3+
* New border style: "rounded"
4+
* Hex and Color can now be serialized / deserialized if the `serde` feature
5+
is enabled.
6+
* `MessageReceiver` is now part of prelude
17
* 0.2.8
28
* An emitter can be created before the runtime
39
* Messages can be emitted to both widget ids and component ids

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ anathema-testutils = { path = "anathema-testutils" }
3131
[features]
3232
default = []
3333
profile = ["anathema-runtime/profile", "anathema-widgets/profile", "anathema-backend/profile"]
34-
serde = ["anathema-store/serde"]
34+
serde = ["anathema-state/serde", "anathema-store/serde"]
3535
# filelog = ["anathema-debug/filelog", "anathema-widgets/filelog", "anathema-runtime/filelog"]
3636

3737
[lints]

anathema-default-widgets/src/border.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ pub const DEFAULT_THICK_EDGES: [Glyph; 8] = [
131131
Glyph::from_char('║', 1),
132132
];
133133

134+
pub const DEFAULT_ROUNDED_EDGES: [Glyph; 8] = [
135+
Glyph::from_char('╭', 1),
136+
Glyph::from_char('─', 1),
137+
Glyph::from_char('╮', 1),
138+
Glyph::from_char('│', 1),
139+
Glyph::from_char('╯', 1),
140+
Glyph::from_char('─', 1),
141+
Glyph::from_char('╰', 1),
142+
Glyph::from_char('│', 1),
143+
];
144+
134145
/// The style of the border.
135146
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
136147
pub enum BorderStyle {
@@ -152,6 +163,7 @@ pub enum BorderStyle {
152163
/// 7hello3
153164
/// 6555554
154165
/// ```
166+
Rounded,
155167
Custom([Glyph; 8]),
156168
}
157169

@@ -160,6 +172,7 @@ impl BorderStyle {
160172
match self {
161173
BorderStyle::Thin => DEFAULT_SLIM_EDGES,
162174
BorderStyle::Thick => DEFAULT_THICK_EDGES,
175+
BorderStyle::Rounded => DEFAULT_ROUNDED_EDGES,
163176
BorderStyle::Custom(edges) => *edges,
164177
}
165178
}
@@ -429,6 +442,7 @@ impl Widget for Border {
429442
match s {
430443
Some("thin") | None => BorderStyle::default(),
431444
Some("thick") => BorderStyle::Thick,
445+
Some("rounded") => BorderStyle::Rounded,
432446
Some(s) => {
433447
let mut glyphs = Glyphs::new(s);
434448
while let Some(g) = glyphs.next(ctx.glyph_map) {

anathema-geometry/src/position.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl SubAssign for Pos {
126126
// -----------------------------------------------------------------------------
127127

128128
/// Positions in a local space.
129-
/// These coordiantes can not be negative.
129+
/// These coordinates can not be negative.
130130
/// `0, 0` refers to top left.
131131
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
132132
pub struct LocalPos {

anathema-runtime/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct Builder<G> {
3131
}
3232

3333
impl<G: GlobalEventHandler> Builder<G> {
34-
/// Create a new runtime builder with a reciver.
34+
/// Create a new runtime builder with a receiver.
3535
/// Use this if the `Emitter` was created outside of the runtime.
3636
pub(super) fn with_receiver(
3737
message_receiver: flume::Receiver<ViewMessage>,

anathema-state/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ repository = "https://github.com/togglebyte/anathema"
1111
[dependencies]
1212
anathema-state-derive = { workspace = true }
1313
anathema-store = { workspace = true }
14+
serde = { version = "1.0", optional = true, features = ["derive"] }
15+
16+
[features]
17+
default = []
18+
serde = ["dep:serde"]
1419

1520
[lints]
1621
workspace = true

anathema-state/src/colors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub trait FromColor {
1111
///
1212
/// [ANSI color table](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors)
1313
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq, Default)]
14+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1415
pub enum Color {
1516
#[default]
1617
Reset,

anathema-state/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl<'a> From<&'a str> for Path<'a> {
4545
}
4646

4747
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
48+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4849
pub struct Hex {
4950
pub r: u8,
5051
pub g: u8,

anathema-state/src/value/maybe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ impl<T: State> Maybe<T> {
2929
self.0.take()
3030
}
3131

32-
/// Get option of a refernce to the underlying value
32+
/// Get option of a reference to the underlying value
3333
pub fn get_ref(&self) -> Option<&Value<T>> {
3434
self.0.as_ref()
3535
}
3636

37-
/// Get option of a mutable refernce to the underlying value
37+
/// Get option of a mutable reference to the underlying value
3838
pub fn get_mut(&mut self) -> Option<&mut Value<T>> {
3939
self.0.as_mut()
4040
}

anathema-store/src/indexmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ where
1414
K: std::hash::Hash,
1515
K: Clone,
1616
{
17-
/// Create an empy index map
17+
/// Create an empty index map
1818
pub fn empty() -> Self {
1919
Self {
2020
slab: Slab::empty(),

0 commit comments

Comments
 (0)