windjammer_ui/components/generated/
style.rs

1#![allow(clippy::all)]
2#![allow(noop_method_call)]
3#[derive(Debug, Clone, Default)]
4pub struct Style {
5    pub properties: Vec<StyleProperty>,
6}
7
8#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
9pub struct StyleProperty {
10    pub name: String,
11    pub value: String,
12}
13
14impl Style {
15    #[inline]
16    pub fn new() -> Style {
17        Style {
18            properties: Vec::new(),
19        }
20    }
21    #[inline]
22    pub fn display(mut self, value: String) -> Style {
23        self.properties.push(StyleProperty {
24            name: "display".to_string(),
25            value,
26        });
27        self
28    }
29    #[inline]
30    pub fn flex_direction(mut self, value: String) -> Style {
31        self.properties.push(StyleProperty {
32            name: "flex-direction".to_string(),
33            value,
34        });
35        self
36    }
37    #[inline]
38    pub fn gap(mut self, value: String) -> Style {
39        self.properties.push(StyleProperty {
40            name: "gap".to_string(),
41            value,
42        });
43        self
44    }
45    #[inline]
46    pub fn align_items(mut self, value: String) -> Style {
47        self.properties.push(StyleProperty {
48            name: "align-items".to_string(),
49            value,
50        });
51        self
52    }
53    #[inline]
54    pub fn justify_content(mut self, value: String) -> Style {
55        self.properties.push(StyleProperty {
56            name: "justify-content".to_string(),
57            value,
58        });
59        self
60    }
61    #[inline]
62    pub fn margin(mut self, value: String) -> Style {
63        self.properties.push(StyleProperty {
64            name: "margin".to_string(),
65            value,
66        });
67        self
68    }
69    #[inline]
70    pub fn padding(mut self, value: String) -> Style {
71        self.properties.push(StyleProperty {
72            name: "padding".to_string(),
73            value,
74        });
75        self
76    }
77    #[inline]
78    pub fn width(mut self, value: String) -> Style {
79        self.properties.push(StyleProperty {
80            name: "width".to_string(),
81            value,
82        });
83        self
84    }
85    #[inline]
86    pub fn height(mut self, value: String) -> Style {
87        self.properties.push(StyleProperty {
88            name: "height".to_string(),
89            value,
90        });
91        self
92    }
93    #[inline]
94    pub fn min_width(mut self, value: String) -> Style {
95        self.properties.push(StyleProperty {
96            name: "min-width".to_string(),
97            value,
98        });
99        self
100    }
101    #[inline]
102    pub fn max_width(mut self, value: String) -> Style {
103        self.properties.push(StyleProperty {
104            name: "max-width".to_string(),
105            value,
106        });
107        self
108    }
109    #[inline]
110    pub fn color(mut self, value: String) -> Style {
111        self.properties.push(StyleProperty {
112            name: "color".to_string(),
113            value,
114        });
115        self
116    }
117    #[inline]
118    pub fn background_color(mut self, value: String) -> Style {
119        self.properties.push(StyleProperty {
120            name: "background-color".to_string(),
121            value,
122        });
123        self
124    }
125    #[inline]
126    pub fn border_color(mut self, value: String) -> Style {
127        self.properties.push(StyleProperty {
128            name: "border-color".to_string(),
129            value,
130        });
131        self
132    }
133    #[inline]
134    pub fn border(mut self, value: String) -> Style {
135        self.properties.push(StyleProperty {
136            name: "border".to_string(),
137            value,
138        });
139        self
140    }
141    #[inline]
142    pub fn border_radius(mut self, value: String) -> Style {
143        self.properties.push(StyleProperty {
144            name: "border-radius".to_string(),
145            value,
146        });
147        self
148    }
149    #[inline]
150    pub fn font_size(mut self, value: String) -> Style {
151        self.properties.push(StyleProperty {
152            name: "font-size".to_string(),
153            value,
154        });
155        self
156    }
157    #[inline]
158    pub fn font_weight(mut self, value: String) -> Style {
159        self.properties.push(StyleProperty {
160            name: "font-weight".to_string(),
161            value,
162        });
163        self
164    }
165    #[inline]
166    pub fn text_align(mut self, value: String) -> Style {
167        self.properties.push(StyleProperty {
168            name: "text-align".to_string(),
169            value,
170        });
171        self
172    }
173    #[inline]
174    pub fn position(mut self, value: String) -> Style {
175        self.properties.push(StyleProperty {
176            name: "position".to_string(),
177            value,
178        });
179        self
180    }
181    #[inline]
182    pub fn top(mut self, value: String) -> Style {
183        self.properties.push(StyleProperty {
184            name: "top".to_string(),
185            value,
186        });
187        self
188    }
189    #[inline]
190    pub fn right(mut self, value: String) -> Style {
191        self.properties.push(StyleProperty {
192            name: "right".to_string(),
193            value,
194        });
195        self
196    }
197    #[inline]
198    pub fn bottom(mut self, value: String) -> Style {
199        self.properties.push(StyleProperty {
200            name: "bottom".to_string(),
201            value,
202        });
203        self
204    }
205    #[inline]
206    pub fn left(mut self, value: String) -> Style {
207        self.properties.push(StyleProperty {
208            name: "left".to_string(),
209            value,
210        });
211        self
212    }
213    #[inline]
214    pub fn opacity(mut self, value: String) -> Style {
215        self.properties.push(StyleProperty {
216            name: "opacity".to_string(),
217            value,
218        });
219        self
220    }
221    #[inline]
222    pub fn box_shadow(mut self, value: String) -> Style {
223        self.properties.push(StyleProperty {
224            name: "box-shadow".to_string(),
225            value,
226        });
227        self
228    }
229    #[inline]
230    pub fn cursor(mut self, value: String) -> Style {
231        self.properties.push(StyleProperty {
232            name: "cursor".to_string(),
233            value,
234        });
235        self
236    }
237    #[inline]
238    pub fn overflow(mut self, value: String) -> Style {
239        self.properties.push(StyleProperty {
240            name: "overflow".to_string(),
241            value,
242        });
243        self
244    }
245    #[inline]
246    pub fn overflow_x(mut self, value: String) -> Style {
247        self.properties.push(StyleProperty {
248            name: "overflow-x".to_string(),
249            value,
250        });
251        self
252    }
253    #[inline]
254    pub fn overflow_y(mut self, value: String) -> Style {
255        self.properties.push(StyleProperty {
256            name: "overflow-y".to_string(),
257            value,
258        });
259        self
260    }
261    #[inline]
262    pub fn to_string(&self) -> String {
263        let mut result = String::new();
264        for (i, prop) in self.properties.iter().enumerate() {
265            if i > 0 {
266                result.push_str("; ")
267            }
268            result.push_str(&prop.name.as_str());
269            result.push_str(": ");
270            result.push_str(&prop.value.as_str());
271        }
272        result
273    }
274}