tailwind_css/systems/css_global/attribute/
mod.rs1use super::*;
2
3mod traits;
4
5#[derive(Debug, Clone, Default, Ord, PartialOrd, Eq, PartialEq, Hash)]
9pub struct CssAttributes {
10    normal: ImportantMap,
11    transforms: ImportantSet,
12    backdrop_filter: ImportantSet,
13    filter: ImportantSet,
14}
15
16impl CssAttributes {
17    #[track_caller]
24    pub fn insert<K, V>(&mut self, key: K, value: V)
25    where
26        K: Into<String>,
27        V: Into<String>,
28    {
29        let key = key.into();
30        match key.as_str() {
31            "transform" => self.transforms.insert(value.into()),
32            "backdrop-filter" => self.backdrop_filter.insert(value.into()),
33            "filter" => self.filter.insert(value.into()),
34            _ => self.normal.insert(key, value.into()),
35        };
36    }
37
38    pub fn extend<T>(&mut self, items: T)
44    where
45        T: IntoIterator<Item = (String, String)>,
46    {
47        for i in items {
48            self.insert(i.0, i.1);
49        }
50    }
51}