stylex_css/values/
common.rs1use crate::values::parser::parse_css;
2
3pub fn split_value_required(strng: Option<&str>) -> (String, String, String, String) {
4 let values = split_value(strng);
5
6 let top = values.0;
7 let right = values.1.unwrap_or(top.clone());
8 let bottom = values.2.unwrap_or(top.clone());
9 let left = values.3.unwrap_or(right.clone());
10
11 (top, right, bottom, left)
12}
13
14pub fn split_value(
15 value: Option<&str>,
16) -> (String, Option<String>, Option<String>, Option<String>) {
17 let nodes = parse_css(value.unwrap_or_default());
18
19 let top = nodes.first().cloned().unwrap_or(String::default());
20 let right = nodes.get(1).cloned();
21 let bottom = nodes.get(2).cloned();
22 let left = nodes.get(3).cloned();
23
24 (top, right, bottom, left)
25}