csslsrs/
css_data.rs

1use serde::Deserialize;
2
3#[derive(Deserialize)]
4#[serde(rename_all = "camelCase")]
5/// Represents any CSS data provided by the user or MDN.
6/// This is used to provide completions and hover information.
7pub struct CssCustomData {
8    pub css: CssSection,
9}
10
11#[derive(Deserialize)]
12#[serde(rename_all = "camelCase")]
13pub struct CssSection {
14    pub at_directives: AtDirectives,
15    pub pseudo_classes: PseudoClasses,
16    pub pseudo_elements: PseudoElements,
17    pub properties: Properties,
18}
19
20#[derive(Deserialize)]
21pub struct AtDirectives {
22    pub entry: Vec<AtDirectiveEntry>,
23}
24
25#[derive(Deserialize)]
26pub struct PseudoClasses {
27    pub entry: Vec<PseudoClassEntry>,
28}
29
30#[derive(Deserialize)]
31pub struct PseudoElements {
32    pub entry: Vec<PseudoElementEntry>,
33}
34
35#[derive(Deserialize)]
36pub struct Properties {
37    pub entry: Vec<PropertyEntry>,
38}
39
40#[derive(Deserialize)]
41pub struct AtDirectiveEntry {
42    #[serde(rename = "$")]
43    pub attributes: AtDirectiveAttributes,
44    pub desc: Option<String>,
45}
46
47#[derive(Deserialize)]
48pub struct PseudoClassEntry {
49    #[serde(rename = "$")]
50    pub attributes: PseudoClassAttributes,
51    pub desc: Option<String>,
52}
53
54#[derive(Deserialize)]
55pub struct PseudoElementEntry {
56    #[serde(rename = "$")]
57    pub attributes: PseudoElementAttributes,
58    pub desc: Option<String>,
59}
60
61#[derive(Deserialize)]
62pub struct PropertyEntry {
63    #[serde(rename = "$")]
64    pub attributes: PropertyAttributes,
65    pub desc: Option<String>,
66}
67
68#[derive(Deserialize)]
69pub struct AtDirectiveAttributes {
70    pub name: String,
71    pub version: Option<String>,
72    pub browsers: Option<String>,
73    #[serde(rename = "ref")]
74    pub ref_: Option<String>,
75    pub syntax: Option<String>,
76}
77
78#[derive(Deserialize)]
79pub struct PseudoClassAttributes {
80    pub name: String,
81    pub version: Option<String>,
82    pub browsers: Option<String>,
83    #[serde(rename = "ref")]
84    pub ref_: Option<String>,
85    pub syntax: Option<String>,
86}
87
88#[derive(Deserialize)]
89pub struct PseudoElementAttributes {
90    pub name: String,
91    pub version: Option<String>,
92    pub browsers: Option<String>,
93    #[serde(rename = "ref")]
94    pub ref_: Option<String>,
95    pub syntax: Option<String>,
96}
97
98#[derive(Deserialize)]
99pub struct PropertyAttributes {
100    pub name: String,
101    pub restriction: Option<String>,
102    pub version: Option<String>,
103    pub browsers: Option<String>,
104    #[serde(rename = "ref")]
105    pub ref_: Option<String>,
106    pub syntax: Option<String>,
107}