css_ast/values/flexbox/mod.rs
1#![allow(warnings)]
2//! CSS Flexible Box Layout Module Level 1
3//! https://drafts.csswg.org/css-flexbox-1/
4
5mod impls;
6use impls::*;
7
8/// Represents the style value for `flex-direction` as defined in [css-flexbox-1](https://drafts.csswg.org/css-flexbox-1/#flex-direction).
9///
10/// Flexbox is a one-dimensional layout system, which places content either horizontally or vertically, with optional wrapping.
11///
12/// The grammar is defined as:
13///
14/// ```text,ignore
15/// row | row-reverse | column | column-reverse
16/// ```
17///
18// https://drafts.csswg.org/css-flexbox-1/#flex-direction
19#[syntax(" row | row-reverse | column | column-reverse ")]
20#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
21#[style_value(
22 initial = "row",
23 applies_to = "flex containers",
24 inherited = "no",
25 percentages = "n/a",
26 canonical_order = "per grammar",
27 animation_type = "discrete"
28)]
29#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
30#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.flex-direction"))]
31#[visit]
32pub enum FlexDirectionStyleValue {}
33
34/// Represents the style value for `flex-wrap` as defined in [css-flexbox-1](https://drafts.csswg.org/css-flexbox-1/#flex-wrap).
35///
36/// Flexbox is a one-dimensional layout system, which places content either horizontally or vertically, with optional wrapping.
37///
38/// The grammar is defined as:
39///
40/// ```text,ignore
41/// nowrap | wrap | wrap-reverse
42/// ```
43///
44// https://drafts.csswg.org/css-flexbox-1/#flex-wrap
45#[syntax(" nowrap | wrap | wrap-reverse ")]
46#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
47#[style_value(
48 initial = "nowrap",
49 applies_to = "flex containers",
50 inherited = "no",
51 percentages = "n/a",
52 canonical_order = "per grammar",
53 animation_type = "discrete"
54)]
55#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
56#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.flex-wrap"))]
57#[visit]
58pub enum FlexWrapStyleValue {}
59
60/// Represents the style value for `flex-flow` as defined in [css-flexbox-1](https://drafts.csswg.org/css-flexbox-1/#flex-flow).
61///
62/// Flexbox is a one-dimensional layout system, which places content either horizontally or vertically, with optional wrapping.
63///
64/// The grammar is defined as:
65///
66/// ```text,ignore
67/// <'flex-direction'> || <'flex-wrap'>
68/// ```
69///
70// https://drafts.csswg.org/css-flexbox-1/#flex-flow
71#[syntax(" <'flex-direction'> || <'flex-wrap'> ")]
72#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
73#[style_value(
74 initial = "see individual properties",
75 applies_to = "see individual properties",
76 inherited = "see individual properties",
77 percentages = "see individual properties",
78 canonical_order = "per grammar",
79 animation_type = "see individual properties"
80)]
81#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
82#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.flex-flow"))]
83#[visit]
84pub struct FlexFlowStyleValue;
85
86// /// Represents the style value for `flex` as defined in [css-flexbox-1](https://drafts.csswg.org/css-flexbox-1/#flex).
87// ///
88// /// Flexbox is a one-dimensional layout system, which places content either horizontally or vertically, with optional wrapping.
89// ///
90// /// The grammar is defined as:
91// ///
92// /// ```text,ignore
93// /// none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
94// /// ```
95// ///
96// // https://drafts.csswg.org/css-flexbox-1/#flex
97// #[syntax(" none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ] ")]
98// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
99// #[style_value(
100// initial = "0 1 auto",
101// applies_to = "flex items",
102// inherited = "no",
103// percentages = "see individual properties",
104// canonical_order = "per grammar",
105// animation_type = "by computed value type",
106// )]
107// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
108// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.flex"))]
109// #[visit]
110// pub enum FlexStyleValue {}
111
112/// Represents the style value for `flex-grow` as defined in [css-flexbox-1](https://drafts.csswg.org/css-flexbox-1/#flex-grow).
113///
114/// Flexbox is a one-dimensional layout system, which places content either horizontally or vertically, with optional wrapping.
115///
116/// The grammar is defined as:
117///
118/// ```text,ignore
119/// <number [0,∞]>
120/// ```
121///
122// https://drafts.csswg.org/css-flexbox-1/#flex-grow
123#[syntax(" <number [0,∞]> ")]
124#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
125#[style_value(
126 initial = "0",
127 applies_to = "flex items",
128 inherited = "no",
129 percentages = "n/a",
130 canonical_order = "per grammar",
131 animation_type = "by computed value type"
132)]
133#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
134#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.flex-grow"))]
135#[visit]
136pub struct FlexGrowStyleValue;
137
138/// Represents the style value for `flex-shrink` as defined in [css-flexbox-1](https://drafts.csswg.org/css-flexbox-1/#flex-shrink).
139///
140/// Flexbox is a one-dimensional layout system, which places content either horizontally or vertically, with optional wrapping.
141///
142/// The grammar is defined as:
143///
144/// ```text,ignore
145/// <number [0,∞]>
146/// ```
147///
148// https://drafts.csswg.org/css-flexbox-1/#flex-shrink
149#[syntax(" <number [0,∞]> ")]
150#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
151#[style_value(
152 initial = "1",
153 applies_to = "flex items",
154 inherited = "no",
155 percentages = "n/a",
156 canonical_order = "per grammar",
157 animation_type = "number"
158)]
159#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
160#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.flex-shrink"))]
161#[visit]
162pub struct FlexShrinkStyleValue;
163
164/// Represents the style value for `flex-basis` as defined in [css-flexbox-1](https://drafts.csswg.org/css-flexbox-1/#flex-basis).
165///
166/// Flexbox is a one-dimensional layout system, which places content either horizontally or vertically, with optional wrapping.
167///
168/// The grammar is defined as:
169///
170/// ```text,ignore
171/// content | <'width'>
172/// ```
173///
174// https://drafts.csswg.org/css-flexbox-1/#flex-basis
175#[syntax(" content | <'width'> ")]
176#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
177#[style_value(
178 initial = "auto",
179 applies_to = "flex items",
180 inherited = "no",
181 percentages = "relative to the flex container’s inner main size",
182 canonical_order = "per grammar",
183 animation_type = "by computed value type"
184)]
185#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
186#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.flex-basis"))]
187#[visit]
188pub enum FlexBasisStyleValue {}