use std::panic::Location;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Kind {
Group,
Card,
Button,
Badge,
Text,
Heading,
Spacer,
Divider,
Overlay,
Scrim,
Modal,
Scroll,
VirtualList,
Inlines,
HardBreak,
Math,
Image,
Surface,
Vector,
Custom(&'static str),
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum SurfaceRole {
#[default]
None,
Panel,
Raised,
Sunken,
Popover,
Selected,
Current,
Input,
Danger,
}
impl SurfaceRole {
pub fn name(self) -> &'static str {
match self {
SurfaceRole::None => "none",
SurfaceRole::Panel => "panel",
SurfaceRole::Raised => "raised",
SurfaceRole::Sunken => "sunken",
SurfaceRole::Popover => "popover",
SurfaceRole::Selected => "selected",
SurfaceRole::Current => "current",
SurfaceRole::Input => "input",
SurfaceRole::Danger => "danger",
}
}
pub fn uniform_id(self) -> f32 {
match self {
SurfaceRole::None => 0.0,
SurfaceRole::Panel => 1.0,
SurfaceRole::Raised => 2.0,
SurfaceRole::Sunken => 3.0,
SurfaceRole::Popover => 4.0,
SurfaceRole::Selected => 5.0,
SurfaceRole::Current => 6.0,
SurfaceRole::Input => 7.0,
SurfaceRole::Danger => 8.0,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
#[non_exhaustive]
pub enum InteractionState {
#[default]
Default,
Hover,
Press,
Focus,
Disabled,
Loading,
}
#[derive(Clone, Copy, Debug, Default)]
#[non_exhaustive]
pub struct Source {
pub file: &'static str,
pub line: u32,
pub from_library: bool,
}
impl Source {
pub fn from_caller(loc: &'static Location<'static>) -> Self {
Self {
file: loc.file(),
line: loc.line(),
from_library: false,
}
}
}