Skip to main content

stylex_css/order/structures/
property_specificity_order.rs

1use crate::order::constants::property_specificity_order::{Aliases, Shorthands};
2
3use stylex_structures::{order::Order, order_pair::OrderPair};
4
5pub struct PropertySpecificityOrder {}
6
7impl Order for PropertySpecificityOrder {
8  fn get_expansion_fn(
9    property: &str,
10  ) -> Option<fn(Option<String>) -> Result<Vec<OrderPair>, String>> {
11    let alias_fn = Aliases::get(property);
12
13    if let Some(alias_fn) = alias_fn {
14      return Some(alias_fn);
15    }
16
17    let shorthand = Shorthands::get(property);
18
19    if let Some(shorthand_fn) = shorthand {
20      return Some(shorthand_fn);
21    }
22
23    None
24  }
25}