add context

This commit is contained in:
JMARyA 2025-01-15 22:52:38 +01:00
parent 78e3d6b798
commit f3a85de02e
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 13 additions and 0 deletions

View file

@ -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;

View file

@ -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<String> {
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<T: UIWidget>(inner: T) -> PreEscaped<String> {
html! { (inner) }
}
/// Generates a `<script>` element containing the provided JavaScript code.
///
/// This function wraps the provided JavaScript code in a `<script>` tag,