pub use waterui_core::metadata::{IgnorableMetadata, Metadata, MetadataKey, Retain};
pub mod context_menu {
use alloc::vec::Vec;
use nami::Computed;
use waterui_controls::menu::{MenuItem, MenuView, ResolvedMenuItem, resolve_menu_items};
use waterui_core::{Environment, Metadata, View, metadata::MetadataKey};
#[derive(Debug)]
pub struct ContextMenu {
pub items: Computed<Vec<MenuItem>>,
}
impl MetadataKey for ContextMenu {}
impl ContextMenu {
#[must_use]
pub fn new(items: impl MenuView) -> Self {
Self {
items: items.into_menu_items(),
}
}
}
#[doc(hidden)]
#[derive(Debug)]
pub struct ResolvedContextMenu {
pub items: Computed<Vec<ResolvedMenuItem>>,
}
impl MetadataKey for ResolvedContextMenu {}
#[doc(hidden)]
#[derive(Debug)]
pub struct ContextMenuView<Content> {
pub content: Content,
pub items: Computed<Vec<MenuItem>>,
}
impl<Content: View> View for ContextMenuView<Content> {
fn body(self, env: &Environment) -> impl View {
let items = resolve_menu_items(&self.items, env);
Metadata::new(self.content, ResolvedContextMenu { items })
}
}
}
pub mod secure {
use waterui_core::metadata::MetadataKey;
#[derive(Debug)]
pub struct Secure;
impl MetadataKey for Secure {}
impl Default for Secure {
fn default() -> Self {
Self::new()
}
}
impl Secure {
#[must_use]
pub const fn new() -> Self {
Self
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ColorSpace {
Sdr,
#[default]
Hdr,
}
nami::impl_constant!(ColorSpace);
#[derive(Debug)]
pub struct StandardDynamicRange;
impl MetadataKey for StandardDynamicRange {}
impl StandardDynamicRange {
#[must_use]
pub const fn new() -> Self {
Self
}
}
impl Default for StandardDynamicRange {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug)]
pub struct HighDynamicRange;
impl MetadataKey for HighDynamicRange {}
impl HighDynamicRange {
#[must_use]
pub const fn new() -> Self {
Self
}
}
impl Default for HighDynamicRange {
fn default() -> Self {
Self::new()
}
}
}