use crate::foundations::{Content, Smart, elem};
use crate::introspection::{Locatable, Tagged};
use crate::layout::{Abs, Corners, Length, Rel, Sides};
use crate::text::{BottomEdge, BottomEdgeMetric, TopEdge, TopEdgeMetric};
use crate::visualize::{Color, FixedStroke, Paint, Stroke};
#[elem(Locatable, Tagged)]
pub struct UnderlineElem {
#[fold]
pub stroke: Smart<Stroke>,
pub offset: Smart<Length>,
pub extent: Length,
#[default(true)]
pub evade: bool,
#[default(false)]
pub background: bool,
#[required]
pub body: Content,
}
#[elem(Locatable, Tagged)]
pub struct OverlineElem {
#[fold]
pub stroke: Smart<Stroke>,
pub offset: Smart<Length>,
pub extent: Length,
#[default(true)]
pub evade: bool,
#[default(false)]
pub background: bool,
#[required]
pub body: Content,
}
#[elem(title = "Strikethrough", Locatable, Tagged)]
pub struct StrikeElem {
#[fold]
pub stroke: Smart<Stroke>,
pub offset: Smart<Length>,
pub extent: Length,
#[default(false)]
pub background: bool,
#[required]
pub body: Content,
}
#[elem(Locatable, Tagged)]
pub struct HighlightElem {
#[default(Some(Color::from_u8(0xFF, 0xFD, 0x11, 0xA1).into()))]
pub fill: Option<Paint>,
#[fold]
pub stroke: Sides<Option<Option<Stroke>>>,
#[default(TopEdge::Metric(TopEdgeMetric::Ascender))]
pub top_edge: TopEdge,
#[default(BottomEdge::Metric(BottomEdgeMetric::Descender))]
pub bottom_edge: BottomEdge,
pub extent: Length,
#[fold]
pub radius: Corners<Option<Rel<Length>>>,
#[required]
pub body: Content,
}
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct Decoration {
pub line: DecoLine,
pub extent: Abs,
}
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
#[allow(clippy::large_enum_variant)]
pub enum DecoLine {
Underline {
stroke: Stroke<Abs>,
offset: Smart<Abs>,
evade: bool,
background: bool,
},
Strikethrough {
stroke: Stroke<Abs>,
offset: Smart<Abs>,
background: bool,
},
Overline {
stroke: Stroke<Abs>,
offset: Smart<Abs>,
evade: bool,
background: bool,
},
Highlight {
fill: Option<Paint>,
stroke: Sides<Option<FixedStroke>>,
top_edge: TopEdge,
bottom_edge: BottomEdge,
radius: Corners<Rel<Abs>>,
},
}