From f3a85de02e21136d75787525f832948e897e3c33 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Wed, 15 Jan 2025 22:52:38 +0100 Subject: [PATCH] add context --- src/ui/mod.rs | 1 + src/ui/primitives/mod.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 92b4da5..b769b24 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -16,6 +16,7 @@ pub mod components; pub mod prelude { pub use super::color::*; pub use super::primitives::Nothing; + pub use super::primitives::Context; pub use super::primitives::Side; pub use super::primitives::Size; pub use super::primitives::aspect::Aspect; diff --git a/src/ui/primitives/mod.rs b/src/ui/primitives/mod.rs index dcd1a31..2595030 100644 --- a/src/ui/primitives/mod.rs +++ b/src/ui/primitives/mod.rs @@ -1,5 +1,7 @@ use maud::{PreEscaped, html}; +use super::UIWidget; + pub mod aspect; pub mod background; pub mod container; @@ -25,6 +27,16 @@ pub fn Nothing() -> PreEscaped { html! {} } +#[allow(non_snake_case)] +#[must_use] +/// Create a new inheritance context +/// +/// This acts as a hard barrier for inheritance. +/// This allows you to embed Widgets without them interacting with the rest of the tree. +pub fn Context(inner: T) -> PreEscaped { + html! { (inner) } +} + /// Generates a `