pub(super) fn parse_style_decl(s: &str) -> Option<(&str, &str)> {
let s = s.trim().trim_end_matches(';').trim();
if s.is_empty() {
return None;
}
let (k, v) = s.split_once(':')?;
let k = k.trim();
let v = v.trim();
if k.is_empty() || v.is_empty() {
return None;
}
Some((k, v))
}
pub(super) fn is_rect_style_key(key: &str) -> bool {
matches!(
key,
"fill"
| "stroke"
| "stroke-width"
| "stroke-dasharray"
| "opacity"
| "fill-opacity"
| "stroke-opacity"
)
}
pub(super) fn is_text_style_key(key: &str) -> bool {
matches!(
key,
"color" | "font-family" | "font-size" | "font-weight" | "opacity"
)
}