figma_api/models/
has_frame_properties_trait.rs

1/*
2 * Figma API
3 *
4 * This is the OpenAPI specification for the [Figma REST API](https://www.figma.com/developers/api).  Note: we are releasing the OpenAPI specification as a beta given the large surface area and complexity of the REST API. If you notice any inaccuracies with the specification, please [file an issue](https://github.com/figma/rest-api-spec/issues).
5 *
6 * The version of the OpenAPI document: 0.31.0
7 * Contact: support@figma.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct HasFramePropertiesTrait {
16    /// Whether or not this node clip content outside of its bounds
17    #[serde(rename = "clipsContent")]
18    pub clips_content: bool,
19    /// Background of the node. This is deprecated, as backgrounds for frames are now in the `fills` field.
20    #[serde(rename = "background", skip_serializing_if = "Option::is_none")]
21    pub background: Option<Vec<models::Paint>>,
22    /// Background color of the node. This is deprecated, as frames now support more than a solid color as a background. Please use the `fills` field instead.
23    #[serde(rename = "backgroundColor", skip_serializing_if = "Option::is_none")]
24    pub background_color: Option<Box<models::Rgba>>,
25    /// An array of layout grids attached to this node (see layout grids section for more details). GROUP nodes do not have this attribute
26    #[serde(rename = "layoutGrids", skip_serializing_if = "Option::is_none")]
27    pub layout_grids: Option<Vec<models::LayoutGrid>>,
28    /// Whether a node has primary axis scrolling, horizontal or vertical.
29    #[serde(rename = "overflowDirection", skip_serializing_if = "Option::is_none")]
30    pub overflow_direction: Option<OverflowDirection>,
31    /// Whether this layer uses auto-layout to position its children.
32    #[serde(rename = "layoutMode", skip_serializing_if = "Option::is_none")]
33    pub layout_mode: Option<LayoutMode>,
34    /// Whether the primary axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames.
35    #[serde(rename = "primaryAxisSizingMode", skip_serializing_if = "Option::is_none")]
36    pub primary_axis_sizing_mode: Option<PrimaryAxisSizingMode>,
37    /// Whether the counter axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames.
38    #[serde(rename = "counterAxisSizingMode", skip_serializing_if = "Option::is_none")]
39    pub counter_axis_sizing_mode: Option<CounterAxisSizingMode>,
40    /// Determines how the auto-layout frame's children should be aligned in the primary axis direction. This property is only applicable for auto-layout frames.
41    #[serde(rename = "primaryAxisAlignItems", skip_serializing_if = "Option::is_none")]
42    pub primary_axis_align_items: Option<PrimaryAxisAlignItems>,
43    /// Determines how the auto-layout frame's children should be aligned in the counter axis direction. This property is only applicable for auto-layout frames.
44    #[serde(rename = "counterAxisAlignItems", skip_serializing_if = "Option::is_none")]
45    pub counter_axis_align_items: Option<CounterAxisAlignItems>,
46    /// The padding between the left border of the frame and its children. This property is only applicable for auto-layout frames.
47    #[serde(rename = "paddingLeft", skip_serializing_if = "Option::is_none")]
48    pub padding_left: Option<f64>,
49    /// The padding between the right border of the frame and its children. This property is only applicable for auto-layout frames.
50    #[serde(rename = "paddingRight", skip_serializing_if = "Option::is_none")]
51    pub padding_right: Option<f64>,
52    /// The padding between the top border of the frame and its children. This property is only applicable for auto-layout frames.
53    #[serde(rename = "paddingTop", skip_serializing_if = "Option::is_none")]
54    pub padding_top: Option<f64>,
55    /// The padding between the bottom border of the frame and its children. This property is only applicable for auto-layout frames.
56    #[serde(rename = "paddingBottom", skip_serializing_if = "Option::is_none")]
57    pub padding_bottom: Option<f64>,
58    /// The distance between children of the frame. Can be negative. This property is only applicable for auto-layout frames.
59    #[serde(rename = "itemSpacing", skip_serializing_if = "Option::is_none")]
60    pub item_spacing: Option<f64>,
61    /// Determines the canvas stacking order of layers in this frame. When true, the first layer will be draw on top. This property is only applicable for auto-layout frames.
62    #[serde(rename = "itemReverseZIndex", skip_serializing_if = "Option::is_none")]
63    pub item_reverse_z_index: Option<bool>,
64    /// Determines whether strokes are included in layout calculations. When true, auto-layout frames behave like css \"box-sizing: border-box\". This property is only applicable for auto-layout frames.
65    #[serde(rename = "strokesIncludedInLayout", skip_serializing_if = "Option::is_none")]
66    pub strokes_included_in_layout: Option<bool>,
67    /// Whether this auto-layout frame has wrapping enabled.
68    #[serde(rename = "layoutWrap", skip_serializing_if = "Option::is_none")]
69    pub layout_wrap: Option<LayoutWrap>,
70    /// The distance between wrapped tracks of an auto-layout frame. This property is only applicable for auto-layout frames with `layoutWrap: \"WRAP\"`
71    #[serde(rename = "counterAxisSpacing", skip_serializing_if = "Option::is_none")]
72    pub counter_axis_spacing: Option<f64>,
73    /// Determines how the auto-layout frame’s wrapped tracks should be aligned in the counter axis direction. This property is only applicable for auto-layout frames with `layoutWrap: \"WRAP\"`.
74    #[serde(rename = "counterAxisAlignContent", skip_serializing_if = "Option::is_none")]
75    pub counter_axis_align_content: Option<CounterAxisAlignContent>,
76}
77
78impl HasFramePropertiesTrait {
79    pub fn new(clips_content: bool) -> HasFramePropertiesTrait {
80        HasFramePropertiesTrait {
81            clips_content,
82            background: None,
83            background_color: None,
84            layout_grids: None,
85            overflow_direction: None,
86            layout_mode: None,
87            primary_axis_sizing_mode: None,
88            counter_axis_sizing_mode: None,
89            primary_axis_align_items: None,
90            counter_axis_align_items: None,
91            padding_left: None,
92            padding_right: None,
93            padding_top: None,
94            padding_bottom: None,
95            item_spacing: None,
96            item_reverse_z_index: None,
97            strokes_included_in_layout: None,
98            layout_wrap: None,
99            counter_axis_spacing: None,
100            counter_axis_align_content: None,
101        }
102    }
103}
104/// Whether a node has primary axis scrolling, horizontal or vertical.
105#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
106pub enum OverflowDirection {
107    #[serde(rename = "HORIZONTAL_SCROLLING")]
108    HorizontalScrolling,
109    #[serde(rename = "VERTICAL_SCROLLING")]
110    VerticalScrolling,
111    #[serde(rename = "HORIZONTAL_AND_VERTICAL_SCROLLING")]
112    HorizontalAndVerticalScrolling,
113    #[serde(rename = "NONE")]
114    None,
115}
116
117impl Default for OverflowDirection {
118    fn default() -> OverflowDirection {
119        Self::HorizontalScrolling
120    }
121}
122/// Whether this layer uses auto-layout to position its children.
123#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
124pub enum LayoutMode {
125    #[serde(rename = "NONE")]
126    None,
127    #[serde(rename = "HORIZONTAL")]
128    Horizontal,
129    #[serde(rename = "VERTICAL")]
130    Vertical,
131}
132
133impl Default for LayoutMode {
134    fn default() -> LayoutMode {
135        Self::None
136    }
137}
138/// Whether the primary axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames.
139#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
140pub enum PrimaryAxisSizingMode {
141    #[serde(rename = "FIXED")]
142    Fixed,
143    #[serde(rename = "AUTO")]
144    Auto,
145}
146
147impl Default for PrimaryAxisSizingMode {
148    fn default() -> PrimaryAxisSizingMode {
149        Self::Fixed
150    }
151}
152/// Whether the counter axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames.
153#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
154pub enum CounterAxisSizingMode {
155    #[serde(rename = "FIXED")]
156    Fixed,
157    #[serde(rename = "AUTO")]
158    Auto,
159}
160
161impl Default for CounterAxisSizingMode {
162    fn default() -> CounterAxisSizingMode {
163        Self::Fixed
164    }
165}
166/// Determines how the auto-layout frame's children should be aligned in the primary axis direction. This property is only applicable for auto-layout frames.
167#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
168pub enum PrimaryAxisAlignItems {
169    #[serde(rename = "MIN")]
170    Min,
171    #[serde(rename = "CENTER")]
172    Center,
173    #[serde(rename = "MAX")]
174    Max,
175    #[serde(rename = "SPACE_BETWEEN")]
176    SpaceBetween,
177}
178
179impl Default for PrimaryAxisAlignItems {
180    fn default() -> PrimaryAxisAlignItems {
181        Self::Min
182    }
183}
184/// Determines how the auto-layout frame's children should be aligned in the counter axis direction. This property is only applicable for auto-layout frames.
185#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
186pub enum CounterAxisAlignItems {
187    #[serde(rename = "MIN")]
188    Min,
189    #[serde(rename = "CENTER")]
190    Center,
191    #[serde(rename = "MAX")]
192    Max,
193    #[serde(rename = "BASELINE")]
194    Baseline,
195}
196
197impl Default for CounterAxisAlignItems {
198    fn default() -> CounterAxisAlignItems {
199        Self::Min
200    }
201}
202/// Whether this auto-layout frame has wrapping enabled.
203#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
204pub enum LayoutWrap {
205    #[serde(rename = "NO_WRAP")]
206    NoWrap,
207    #[serde(rename = "WRAP")]
208    Wrap,
209}
210
211impl Default for LayoutWrap {
212    fn default() -> LayoutWrap {
213        Self::NoWrap
214    }
215}
216/// Determines how the auto-layout frame’s wrapped tracks should be aligned in the counter axis direction. This property is only applicable for auto-layout frames with `layoutWrap: \"WRAP\"`.
217#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
218pub enum CounterAxisAlignContent {
219    #[serde(rename = "AUTO")]
220    Auto,
221    #[serde(rename = "SPACE_BETWEEN")]
222    SpaceBetween,
223}
224
225impl Default for CounterAxisAlignContent {
226    fn default() -> CounterAxisAlignContent {
227        Self::Auto
228    }
229}
230