tailwind_css_fixes/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,
12 transforms: ImportantSet,
13 backdrop_filter: ImportantSet,
14 filter: ImportantSet,
15 nested: BTreeMap<String, Box<CssAttributes>>,
18}
19
20impl CssAttributes {
21 #[track_caller]
28 pub fn insert<K, V>(&mut self, key: K, value: V)
29 where
30 K: Into<String>,
31 V: Into<String>,
32 {
33 let key = key.into();
34 match key.as_str() {
35 "transform" => self.transforms.insert(value.into()),
36 "backdrop-filter" => self.backdrop_filter.insert(value.into()),
37 "filter" => self.filter.insert(value.into()),
38 _ => self.normal.insert(key, value.into()),
39 };
40 }
41
42 pub fn extend<T>(&mut self, items: T)
48 where
49 T: IntoIterator<Item = (String, String)>,
50 {
51 for i in items {
52 self.insert(i.0, i.1);
53 }
54 }
55
56 pub fn insert_nested<S>(&mut self, selector: S, attributes: CssAttributes)
62 where
63 S: Into<String>,
64 {
65 self.nested.insert(selector.into(), Box::new(attributes));
66 }
67}