css_ast/values/transforms/mod.rs
1#![allow(warnings)]
2//! https://drafts.csswg.org/css-transforms-2/
3
4mod impls;
5use super::prelude::*;
6use impls::*;
7/// Represents the style value for `backface-visibility` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#backface-visibility).
8///
9/// The transform CSS property and its 3D transform functions allow rotations and other transforms in three dimensions, including perspective transforms.
10///
11/// The grammar is defined as:
12///
13/// ```text,ignore
14/// visible | hidden
15/// ```
16///
17/// https://drafts.csswg.org/css-transforms-2/#backface-visibility
18#[syntax(" visible | hidden ")]
19#[derive(
20 Parse, Peek, ToSpan, ToCursors, DeclarationMetadata, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
21)]
22#[declaration_metadata(
23 initial = "visible",
24 applies_to = Unknown,
25 animation_type = Discrete,
26 property_group = Transforms,
27 computed_value_type = Unknown,
28 canonical_order = "per grammar",
29)]
30#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
31#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.backface-visibility"))]
32#[cfg_attr(feature = "visitable", derive(Visitable), visit)]
33pub enum BackfaceVisibilityStyleValue {}
34
35/// Represents the style value for `perspective` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#perspective).
36///
37/// The transform CSS property and its 3D transform functions allow rotations and other transforms in three dimensions, including perspective transforms.
38///
39/// The grammar is defined as:
40///
41/// ```text,ignore
42/// none | <length [0,∞]>
43/// ```
44///
45/// https://drafts.csswg.org/css-transforms-2/#perspective
46#[syntax(" none | <length [0,∞]> ")]
47#[derive(
48 Parse, Peek, ToSpan, ToCursors, DeclarationMetadata, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
49)]
50#[declaration_metadata(
51 initial = "none",
52 applies_to = Unknown,
53 animation_type = ByComputedValue,
54 property_group = Transforms,
55 computed_value_type = AbsoluteLengthOrNone,
56 canonical_order = "per grammar",
57)]
58#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
59#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.perspective"))]
60#[cfg_attr(feature = "visitable", derive(Visitable), visit)]
61pub struct PerspectiveStyleValue;
62
63/// Represents the style value for `perspective-origin` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#perspective-origin).
64///
65/// The transform CSS property and its 3D transform functions allow rotations and other transforms in three dimensions, including perspective transforms.
66///
67/// The grammar is defined as:
68///
69/// ```text,ignore
70/// <position>
71/// ```
72///
73/// https://drafts.csswg.org/css-transforms-2/#perspective-origin
74#[syntax(" <position> ")]
75#[derive(
76 Parse, Peek, ToSpan, ToCursors, DeclarationMetadata, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
77)]
78#[declaration_metadata(
79 initial = "50% 50%",
80 applies_to = Unknown,
81 percentages = ReferenceBox,
82 animation_type = ByComputedValue,
83 property_group = Transforms,
84 computed_value_type = Unknown,
85 canonical_order = "per grammar",
86)]
87#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
88#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.perspective-origin"))]
89#[cfg_attr(feature = "visitable", derive(Visitable), visit)]
90pub struct PerspectiveOriginStyleValue;
91
92// /// Represents the style value for `rotate` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#rotate).
93// ///
94// /// The translate, rotate, and scale CSS properties apply single transformations independently, as opposed to applying multiple transformations with the transform CSS property.
95// ///
96// /// The grammar is defined as:
97// ///
98// /// ```text,ignore
99// /// none | <angle> | [ x | y | z | <number>{3} ] && <angle>
100// /// ```
101// ///
102// /// https://drafts.csswg.org/css-transforms-2/#rotate
103// #[syntax(" none | <angle> | [ x | y | z | <number>{3} ] && <angle> ")]
104// #[derive(
105// Parse,
106// Peek,
107// ToSpan,
108// ToCursors,
109// DeclarationMetadata,
110// SemanticEq,
111// Debug,
112// Clone,
113// PartialEq,
114// Eq,
115// PartialOrd,
116// Ord,
117// Hash,
118// )]
119// #[declaration_metadata(
120// initial = "none",
121// applies_to = Unknown,
122// animation_type = Unknown,
123// property_group = Transforms,
124// computed_value_type = Unknown,
125// canonical_order = "per grammar",
126// )]
127// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
128// #[cfg_attr(
129// feature = "css_feature_data",
130// derive(ToCSSFeature),
131// css_feature("css.properties.rotate")
132// )]
133// #[cfg_attr(feature = "visitable", derive(Visitable), visit)]
134// pub enum RotateStyleValue {}
135
136/// Represents the style value for `scale` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#scale).
137///
138/// The translate, rotate, and scale CSS properties apply single transformations independently, as opposed to applying multiple transformations with the transform CSS property.
139///
140/// The grammar is defined as:
141///
142/// ```text,ignore
143/// none | [ <number> | <percentage> ]{1,3}
144/// ```
145///
146/// https://drafts.csswg.org/css-transforms-2/#scale
147#[syntax(" none | [ <number> | <percentage> ]{1,3} ")]
148#[derive(
149 Parse, Peek, ToSpan, ToCursors, DeclarationMetadata, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
150)]
151#[declaration_metadata(
152 initial = "none",
153 applies_to = Unknown,
154 animation_type = ByComputedValue,
155 property_group = Transforms,
156 computed_value_type = Unknown,
157 canonical_order = "per grammar",
158)]
159#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
160#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.scale"))]
161#[cfg_attr(feature = "visitable", derive(Visitable), visit)]
162pub struct ScaleStyleValue;
163
164/// Represents the style value for `transform` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#transform).
165///
166/// The transform CSS property and its 2D transform functions allow rotating, scaling, skewing, and translating an element. Arbitrary 2D transforms are also possible using a transformation matrix.
167///
168/// The grammar is defined as:
169///
170/// ```text,ignore
171/// none | <transform-list>
172/// ```
173///
174/// https://drafts.csswg.org/css-transforms-2/#transform
175#[syntax(" none | <transform-list> ")]
176#[derive(
177 Parse, Peek, ToSpan, ToCursors, DeclarationMetadata, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
178)]
179#[declaration_metadata(
180 initial = "none",
181 applies_to = Unknown,
182 percentages = ReferenceBox,
183 animation_type = TransformList,
184 property_group = Transforms,
185 computed_value_type = AsSpecified,
186 canonical_order = "per grammar",
187)]
188#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
189#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.transform"))]
190#[cfg_attr(feature = "visitable", derive(Visitable), visit)]
191pub struct TransformStyleValue<'a>;
192
193/// Represents the style value for `transform-box` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#transform-box).
194///
195/// The transform-box CSS property sets the position and dimensions of the reference box relative to which an element's transformations are calculated.
196///
197/// The grammar is defined as:
198///
199/// ```text,ignore
200/// content-box | border-box | fill-box | stroke-box | view-box
201/// ```
202///
203/// https://drafts.csswg.org/css-transforms-2/#transform-box
204#[syntax(" content-box | border-box | fill-box | stroke-box | view-box ")]
205#[derive(
206 Parse, Peek, ToSpan, ToCursors, DeclarationMetadata, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
207)]
208#[declaration_metadata(
209 initial = "view-box",
210 applies_to = Unknown,
211 animation_type = Discrete,
212 property_group = Transforms,
213 computed_value_type = Unknown,
214 canonical_order = "per grammar",
215)]
216#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
217#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.transform-box"))]
218#[cfg_attr(feature = "visitable", derive(Visitable), visit)]
219pub enum TransformBoxStyleValue {}
220
221// /// Represents the style value for `transform-origin` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#transform-origin).
222// ///
223// /// The transform CSS property and its 2D transform functions allow rotating, scaling, skewing, and translating an element. Arbitrary 2D transforms are also possible using a transformation matrix.
224// ///
225// /// The grammar is defined as:
226// ///
227// /// ```text,ignore
228// /// [ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] <length>? | [ [ center | left | right ] && [ center | top | bottom ] ] <length>?
229// /// ```
230// ///
231// /// https://drafts.csswg.org/css-transforms-2/#transform-origin
232// #[syntax(
233// " [ left | center | right | top | bottom | <length-percentage> ] | \u{a0}\u{a0}[ left | center | right | <length-percentage> ]\u{a0}\u{a0}[ top | center | bottom | <length-percentage> ] <length>? |\u{a0}\u{a0}[ [ center | left | right ] && [ center | top | bottom ] ] <length>? "
234// )]
235// #[derive(
236// Parse,
237// Peek,
238// ToSpan,
239// ToCursors,
240// DeclarationMetadata,
241// SemanticEq,
242// Debug,
243// Clone,
244// PartialEq,
245// Eq,
246// PartialOrd,
247// Ord,
248// Hash,
249// )]
250// #[declaration_metadata(
251// initial = "50% 50%",
252// applies_to = Unknown,
253// percentages = ReferenceBox,
254// animation_type = ByComputedValue,
255// property_group = Transforms,
256// computed_value_type = Unknown,
257// canonical_order = "per grammar",
258// )]
259// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
260// #[cfg_attr(
261// feature = "css_feature_data",
262// derive(ToCSSFeature),
263// css_feature("css.properties.transform-origin")
264// )]
265// #[cfg_attr(feature = "visitable", derive(Visitable), visit)]
266// pub enum TransformOriginStyleValue {}
267
268/// Represents the style value for `transform-style` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#transform-style).
269///
270/// The transform CSS property and its 3D transform functions allow rotations and other transforms in three dimensions, including perspective transforms.
271///
272/// The grammar is defined as:
273///
274/// ```text,ignore
275/// flat | preserve-3d
276/// ```
277///
278/// https://drafts.csswg.org/css-transforms-2/#transform-style
279#[syntax(" flat | preserve-3d ")]
280#[derive(
281 Parse, Peek, ToSpan, ToCursors, DeclarationMetadata, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
282)]
283#[declaration_metadata(
284 initial = "flat",
285 applies_to = Unknown,
286 animation_type = Discrete,
287 property_group = Transforms,
288 computed_value_type = Unknown,
289 canonical_order = "per grammar",
290)]
291#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
292#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.transform-style"))]
293#[cfg_attr(feature = "visitable", derive(Visitable), visit)]
294pub enum TransformStyleStyleValue {}
295
296// /// Represents the style value for `translate` as defined in [css-transforms-2](https://drafts.csswg.org/css-transforms-2/#translate).
297// ///
298// /// The translate, rotate, and scale CSS properties apply single transformations independently, as opposed to applying multiple transformations with the transform CSS property.
299// ///
300// /// The grammar is defined as:
301// ///
302// /// ```text,ignore
303// /// none | <length-percentage> [ <length-percentage> <length>? ]?
304// /// ```
305// ///
306// /// https://drafts.csswg.org/css-transforms-2/#translate
307// #[syntax(" none | <length-percentage> [ <length-percentage> <length>? ]? ")]
308// #[derive(
309// Parse,
310// Peek,
311// ToSpan,
312// ToCursors,
313// DeclarationMetadata,
314// SemanticEq,
315// Debug,
316// Clone,
317// PartialEq,
318// Eq,
319// PartialOrd,
320// Ord,
321// Hash,
322// )]
323// #[declaration_metadata(
324// initial = "none",
325// applies_to = Unknown,
326// percentages = ReferenceBox,
327// animation_type = ByComputedValue,
328// property_group = Transforms,
329// computed_value_type = AbsoluteLengthOrPercentage,
330// canonical_order = "per grammar",
331// )]
332// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
333// #[cfg_attr(
334// feature = "css_feature_data",
335// derive(ToCSSFeature),
336// css_feature("css.properties.translate")
337// )]
338// #[cfg_attr(feature = "visitable", derive(Visitable), visit)]
339// pub struct TranslateStyleValue;