diff --git a/Makefile.toml b/Makefile.toml index 52a2461..d3cd5a0 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -49,6 +49,16 @@ args = [ "watch" , "-x", "make -t test" ] +[tasks.cdd] # "compile" driven development? +install_crate = "cargo-watch" +command = "cargo" +args = [ "watch" + , "--watch", "./src" + , "--watch", "./tests" + , "-x", "check" + , "-x", "make fmt" + ] + [tasks.check-fmt] toolchain = "nightly" command = "cargo" diff --git a/src/block_elements/button.rs b/src/block_elements/button.rs index 97f052a..b1103fa 100644 --- a/src/block_elements/button.rs +++ b/src/block_elements/button.rs @@ -25,7 +25,7 @@ use crate::{text, val_helpr::ValidationResult}; /// [Actions 🔗]: https://api.slack.com/reference/block-kit/blocks#actions /// [guide to enabling interactivity 🔗]: https://api.slack.com/interactivity/handling #[derive(Validate, Clone, Debug, Deserialize, Hash, PartialEq, Serialize)] -pub struct Contents { +pub struct Button { #[validate(custom = "validate::text")] text: text::Text, @@ -47,7 +47,7 @@ pub struct Contents { confirm: Option<()>, // FIX: doesn't exist yet } -impl Contents { +impl Button { /// Create a `button::Contents` from a text label and ID for your app /// to be able to identify what was pressed. /// diff --git a/src/block_elements/mod.rs b/src/block_elements/mod.rs index d566a00..8e37e31 100644 --- a/src/block_elements/mod.rs +++ b/src/block_elements/mod.rs @@ -2,16 +2,21 @@ use serde::{Deserialize, Serialize}; use crate::{convert, val_helpr::ValidationResult}; -pub mod radio; -pub use radio::Radio; - pub mod button; -pub use button::Contents as Button; - +pub mod overflow; +pub mod radio; pub mod select; -pub use select::Select; - pub mod text_input; + +#[doc(inline)] +pub use button::Button; +#[doc(inline)] +pub use overflow::Overflow; +#[doc(inline)] +pub use radio::Radio; +#[doc(inline)] +pub use select::Select; +#[doc(inline)] pub use text_input::TextInput; /// # Block Elements - interactive components @@ -36,7 +41,7 @@ pub enum BlockElement<'a> { DatePicker, Image, MultiSelect, - OverflowMenu, + Overflow(Overflow<'a>), RadioButtons(Radio<'a>), #[serde(rename = "plain_text_input")] @@ -68,6 +73,7 @@ impl<'a> BlockElement<'a> { | Self::SelectExternal(cts) => cts.validate(), | Self::SelectStatic(cts) => cts.validate(), | Self::RadioButtons(cts) => cts.validate(), + | Self::Overflow(cts) => cts.validate(), | rest => todo!("validation not implemented for {:?}", rest), } } @@ -76,6 +82,7 @@ impl<'a> BlockElement<'a> { convert!(impl From