|
1 | | -use crate::ExtractStyleValue::Static; |
2 | | -use crate::{ExtractStaticStyle, ExtractStyleValue}; |
| 1 | +use crate::extract_style::ExtractStaticStyle; |
| 2 | +use crate::extract_style::ExtractStyleValue::Static; |
| 3 | +use crate::ExtractStyleValue; |
3 | 4 |
|
4 | 5 | /// devup-ui export variable kind |
5 | 6 | #[derive(Debug, PartialEq, Clone)] |
@@ -40,56 +41,56 @@ impl ExportVariableKind { |
40 | 41 | | ExportVariableKind::Text |
41 | 42 | | ExportVariableKind::Image |
42 | 43 | | ExportVariableKind::Box => vec![], |
43 | | - ExportVariableKind::Flex => vec![Static(ExtractStaticStyle { |
44 | | - value: "flex".to_string(), |
45 | | - property: "display".to_string(), |
46 | | - level: 0, |
47 | | - selector: None, |
48 | | - })], |
| 44 | + ExportVariableKind::Flex => vec![Static(ExtractStaticStyle::new( |
| 45 | + "display".to_string(), |
| 46 | + "flex".to_string(), |
| 47 | + 0, |
| 48 | + None, |
| 49 | + ))], |
49 | 50 | ExportVariableKind::VStack => { |
50 | 51 | vec![ |
51 | | - Static(ExtractStaticStyle { |
52 | | - value: "flex".to_string(), |
53 | | - property: "display".to_string(), |
54 | | - level: 0, |
55 | | - selector: None, |
56 | | - }), |
57 | | - Static(ExtractStaticStyle { |
58 | | - value: "column".to_string(), |
59 | | - property: "flexDirection".to_string(), |
60 | | - level: 0, |
61 | | - selector: None, |
62 | | - }), |
| 52 | + Static(ExtractStaticStyle::new( |
| 53 | + "display".to_string(), |
| 54 | + "flex".to_string(), |
| 55 | + 0, |
| 56 | + None, |
| 57 | + )), |
| 58 | + Static(ExtractStaticStyle::new( |
| 59 | + "flexDirection".to_string(), |
| 60 | + "column".to_string(), |
| 61 | + 0, |
| 62 | + None, |
| 63 | + )), |
63 | 64 | ] |
64 | 65 | } |
65 | 66 | ExportVariableKind::Center => { |
66 | 67 | vec![ |
67 | | - Static(ExtractStaticStyle { |
68 | | - value: "flex".to_string(), |
69 | | - property: "display".to_string(), |
70 | | - level: 0, |
71 | | - selector: None, |
72 | | - }), |
73 | | - Static(ExtractStaticStyle { |
74 | | - value: "center".to_string(), |
75 | | - property: "justifyContent".to_string(), |
76 | | - level: 0, |
77 | | - selector: None, |
78 | | - }), |
79 | | - Static(ExtractStaticStyle { |
80 | | - value: "center".to_string(), |
81 | | - property: "alignItems".to_string(), |
82 | | - level: 0, |
83 | | - selector: None, |
84 | | - }), |
| 68 | + Static(ExtractStaticStyle::new( |
| 69 | + "display".to_string(), |
| 70 | + "flex".to_string(), |
| 71 | + 0, |
| 72 | + None, |
| 73 | + )), |
| 74 | + Static(ExtractStaticStyle::new( |
| 75 | + "justifyContent".to_string(), |
| 76 | + "center".to_string(), |
| 77 | + 0, |
| 78 | + None, |
| 79 | + )), |
| 80 | + Static(ExtractStaticStyle::new( |
| 81 | + "alignItems".to_string(), |
| 82 | + "center".to_string(), |
| 83 | + 0, |
| 84 | + None, |
| 85 | + )), |
85 | 86 | ] |
86 | 87 | } |
87 | | - ExportVariableKind::Grid => vec![Static(ExtractStaticStyle { |
88 | | - value: "grid".to_string(), |
89 | | - property: "display".to_string(), |
90 | | - level: 0, |
91 | | - selector: None, |
92 | | - })], |
| 88 | + ExportVariableKind::Grid => vec![Static(ExtractStaticStyle::new( |
| 89 | + "display".to_string(), |
| 90 | + "grid".to_string(), |
| 91 | + 0, |
| 92 | + None, |
| 93 | + ))], |
93 | 94 | } |
94 | 95 | } |
95 | 96 | } |
@@ -181,61 +182,61 @@ mod tests { |
181 | 182 | assert_eq!(ExportVariableKind::Input.extract(), vec![]); |
182 | 183 | assert_eq!( |
183 | 184 | ExportVariableKind::Flex.extract(), |
184 | | - vec![Static(ExtractStaticStyle { |
185 | | - value: "flex".to_string(), |
186 | | - property: "display".to_string(), |
187 | | - level: 0, |
188 | | - selector: None, |
189 | | - })] |
| 185 | + vec![Static(ExtractStaticStyle::new( |
| 186 | + "display".to_string(), |
| 187 | + "flex".to_string(), |
| 188 | + 0, |
| 189 | + None, |
| 190 | + ))] |
190 | 191 | ); |
191 | 192 | assert_eq!( |
192 | 193 | ExportVariableKind::VStack.extract(), |
193 | 194 | vec![ |
194 | | - Static(ExtractStaticStyle { |
195 | | - value: "flex".to_string(), |
196 | | - property: "display".to_string(), |
197 | | - level: 0, |
198 | | - selector: None, |
199 | | - }), |
200 | | - Static(ExtractStaticStyle { |
201 | | - value: "column".to_string(), |
202 | | - property: "flexDirection".to_string(), |
203 | | - level: 0, |
204 | | - selector: None, |
205 | | - }) |
| 195 | + Static(ExtractStaticStyle::new( |
| 196 | + "display".to_string(), |
| 197 | + "flex".to_string(), |
| 198 | + 0, |
| 199 | + None, |
| 200 | + )), |
| 201 | + Static(ExtractStaticStyle::new( |
| 202 | + "flexDirection".to_string(), |
| 203 | + "column".to_string(), |
| 204 | + 0, |
| 205 | + None, |
| 206 | + )) |
206 | 207 | ] |
207 | 208 | ); |
208 | 209 | assert_eq!( |
209 | 210 | ExportVariableKind::Center.extract(), |
210 | 211 | vec![ |
211 | | - Static(ExtractStaticStyle { |
212 | | - value: "flex".to_string(), |
213 | | - property: "display".to_string(), |
214 | | - level: 0, |
215 | | - selector: None, |
216 | | - }), |
217 | | - Static(ExtractStaticStyle { |
218 | | - value: "center".to_string(), |
219 | | - property: "justifyContent".to_string(), |
220 | | - level: 0, |
221 | | - selector: None, |
222 | | - }), |
223 | | - Static(ExtractStaticStyle { |
224 | | - value: "center".to_string(), |
225 | | - property: "alignItems".to_string(), |
226 | | - level: 0, |
227 | | - selector: None, |
228 | | - }) |
| 212 | + Static(ExtractStaticStyle::new( |
| 213 | + "display".to_string(), |
| 214 | + "flex".to_string(), |
| 215 | + 0, |
| 216 | + None, |
| 217 | + )), |
| 218 | + Static(ExtractStaticStyle::new( |
| 219 | + "justifyContent".to_string(), |
| 220 | + "center".to_string(), |
| 221 | + 0, |
| 222 | + None, |
| 223 | + )), |
| 224 | + Static(ExtractStaticStyle::new( |
| 225 | + "alignItems".to_string(), |
| 226 | + "center".to_string(), |
| 227 | + 0, |
| 228 | + None, |
| 229 | + )) |
229 | 230 | ] |
230 | 231 | ); |
231 | 232 | assert_eq!( |
232 | 233 | ExportVariableKind::Grid.extract(), |
233 | | - vec![Static(ExtractStaticStyle { |
234 | | - value: "grid".to_string(), |
235 | | - property: "display".to_string(), |
236 | | - level: 0, |
237 | | - selector: None, |
238 | | - })] |
| 234 | + vec![Static(ExtractStaticStyle::new( |
| 235 | + "display".to_string(), |
| 236 | + "grid".to_string(), |
| 237 | + 0, |
| 238 | + None, |
| 239 | + ))] |
239 | 240 | ); |
240 | 241 | } |
241 | 242 | } |
0 commit comments