1use omena_parser::StyleDialect;
9use serde::Serialize;
10
11#[derive(Debug, Clone, PartialEq, Eq)]
12pub struct Stylesheet {
13 pub path: String,
14 pub language: StyleDialect,
15 pub source: String,
16}
17
18#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
19#[serde(rename_all = "camelCase")]
20pub struct ParserBoundarySyntaxFactsV0 {
21 pub lossless_cst: ParserLosslessCstFactsV0,
22 pub selectors: ParserIndexSelectorFactsV0,
23 pub values: ParserIndexValueFactsV0,
24 pub custom_properties: ParserIndexCustomPropertyFactsV0,
25 pub sass: ParserSassSyntaxFactsV0,
26 pub keyframes: ParserIndexKeyframesFactsV0,
27 pub composes: ParserIndexComposesFactsV0,
28 pub wrappers: ParserIndexWrapperFactsV0,
29}
30
31#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
32#[serde(rename_all = "camelCase")]
33pub struct ParserLosslessCstFactsV0 {
34 pub source_byte_len: usize,
35 pub token_count: usize,
36 pub root_node_count: usize,
37 pub diagnostic_count: usize,
38 pub all_token_spans_within_source: bool,
39 pub all_node_spans_within_source: bool,
40}
41
42#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
43#[serde(rename_all = "camelCase")]
44pub struct ParserIndexSelectorFactsV0 {
45 pub names: Vec<String>,
46 pub definition_facts: Vec<ParserIndexSelectorDefinitionFactV0>,
47 pub bem_suffix_parent_names: Vec<String>,
48 pub bem_suffix_safe_names: Vec<String>,
49 pub nested_unsafe_names: Vec<String>,
50 pub selectors_with_value_refs_names: Vec<String>,
51 pub selectors_with_animation_ref_names: Vec<String>,
52 pub selectors_with_animation_name_ref_names: Vec<String>,
53 pub bem_suffix_count: usize,
54 pub nested_safety_counts: NestedSafetyCountsV0,
55}
56
57#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Default)]
58#[serde(rename_all = "camelCase")]
59pub struct ParserIndexSelectorDefinitionFactV0 {
60 pub name: String,
61 pub source_order: usize,
62 pub byte_span: ParserByteSpanV0,
63 pub range: ParserRangeV0,
64 pub nested_safety_kind: &'static str,
65 #[serde(skip_serializing_if = "Option::is_none")]
66 pub bem_suffix_parent_name: Option<String>,
67 pub under_media: bool,
68 pub under_supports: bool,
69 pub under_layer: bool,
70}
71
72#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
73#[serde(rename_all = "camelCase")]
74pub struct ParserIndexValueFactsV0 {
75 pub decl_names: Vec<String>,
76 pub decl_names_with_local_refs: Vec<String>,
77 pub decl_names_with_imported_refs: Vec<String>,
78 pub import_names: Vec<String>,
79 pub import_sources: Vec<String>,
80 pub import_alias_count: usize,
81 pub ref_names: Vec<String>,
82 pub local_ref_names: Vec<String>,
83 pub imported_ref_names: Vec<String>,
84 pub imported_ref_sources: Vec<String>,
85 pub declaration_ref_names: Vec<String>,
86 pub declaration_imported_ref_sources: Vec<String>,
87 pub value_decl_ref_names: Vec<String>,
88 pub value_decl_imported_ref_sources: Vec<String>,
89 pub selectors_with_refs_names: Vec<String>,
90 pub selectors_with_local_refs_names: Vec<String>,
91 pub selectors_with_imported_refs_names: Vec<String>,
92 pub selectors_with_refs_under_media_names: Vec<String>,
93 pub selectors_with_refs_under_supports_names: Vec<String>,
94 pub selectors_with_refs_under_layer_names: Vec<String>,
95 pub selectors_with_local_refs_under_media_names: Vec<String>,
96 pub selectors_with_local_refs_under_supports_names: Vec<String>,
97 pub selectors_with_local_refs_under_layer_names: Vec<String>,
98 pub selectors_with_imported_refs_under_media_names: Vec<String>,
99 pub selectors_with_imported_refs_under_supports_names: Vec<String>,
100 pub selectors_with_imported_refs_under_layer_names: Vec<String>,
101}
102
103#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
104#[serde(rename_all = "camelCase")]
105pub struct ParserIndexCustomPropertyFactsV0 {
106 pub decl_names: Vec<String>,
107 pub decl_facts: Vec<ParserIndexCustomPropertyDeclFactV0>,
108 pub decl_context_selectors: Vec<String>,
109 pub decl_names_under_media: Vec<String>,
110 pub decl_names_under_supports: Vec<String>,
111 pub decl_names_under_layer: Vec<String>,
112 pub ref_names: Vec<String>,
113 pub ref_facts: Vec<ParserIndexCustomPropertyRefFactV0>,
114 pub selectors_with_refs_names: Vec<String>,
115 pub selectors_with_refs_under_media_names: Vec<String>,
116 pub selectors_with_refs_under_supports_names: Vec<String>,
117 pub selectors_with_refs_under_layer_names: Vec<String>,
118}
119
120#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Default)]
121#[serde(rename_all = "camelCase")]
122pub struct ParserIndexCustomPropertyDeclFactV0 {
123 pub name: String,
124 pub value: String,
125 pub source_order: usize,
126 pub byte_span: ParserByteSpanV0,
127 pub range: ParserRangeV0,
128 pub selector_contexts: Vec<String>,
129 #[serde(default, skip_serializing_if = "Vec::is_empty")]
130 pub condition_context: Vec<String>,
131 pub layer_names: Vec<String>,
132 pub under_media: bool,
133 pub under_supports: bool,
134 pub under_layer: bool,
135}
136
137#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Default)]
138#[serde(rename_all = "camelCase")]
139pub struct ParserIndexCustomPropertyRefFactV0 {
140 pub name: String,
141 pub source_order: usize,
142 pub selector_contexts: Vec<String>,
143 #[serde(default, skip_serializing_if = "Vec::is_empty")]
144 pub condition_context: Vec<String>,
145 pub layer_names: Vec<String>,
146 pub under_media: bool,
147 pub under_supports: bool,
148 pub under_layer: bool,
149}
150
151#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
152#[serde(rename_all = "camelCase")]
153pub struct ParserSassSyntaxFactsV0 {
154 pub variable_decl_names: Vec<String>,
155 pub variable_parameter_names: Vec<String>,
156 pub variable_ref_names: Vec<String>,
157 pub mixin_decl_names: Vec<String>,
158 pub mixin_include_names: Vec<String>,
159 pub function_decl_names: Vec<String>,
160 pub function_call_names: Vec<String>,
161 pub module_use_sources: Vec<String>,
162 pub module_use_edges: Vec<ParserIndexSassModuleUseFactV0>,
163 pub module_forward_sources: Vec<String>,
164 pub module_import_sources: Vec<String>,
165}
166
167#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize)]
168#[serde(rename_all = "camelCase")]
169pub struct ParserIndexSassModuleUseFactV0 {
170 pub source: String,
171 pub namespace_kind: &'static str,
172 pub namespace: Option<String>,
173}
174
175#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
176#[serde(rename_all = "camelCase")]
177pub struct ParserIndexSassSameFileResolutionFactsV0 {
178 pub resolved_variable_ref_names: Vec<String>,
179 pub unresolved_variable_ref_names: Vec<String>,
180 pub resolved_mixin_include_names: Vec<String>,
181 pub unresolved_mixin_include_names: Vec<String>,
182 pub resolved_function_call_names: Vec<String>,
183}
184
185#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Default)]
186#[serde(rename_all = "camelCase")]
187pub struct ParserByteSpanV0 {
188 pub start: usize,
189 pub end: usize,
190}
191
192#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Default)]
193#[serde(rename_all = "camelCase")]
194pub struct ParserPositionV0 {
195 pub line: usize,
196 pub character: usize,
197}
198
199#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Default)]
200#[serde(rename_all = "camelCase")]
201pub struct ParserRangeV0 {
202 pub start: ParserPositionV0,
203 pub end: ParserPositionV0,
204}
205
206#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize)]
207#[serde(rename_all = "camelCase")]
208pub struct ParserIndexSassSelectorSymbolFactV0 {
209 pub selector_name: String,
210 pub symbol_kind: &'static str,
211 pub name: String,
212 pub namespace: Option<String>,
213 pub role: &'static str,
214 pub resolution: &'static str,
215 pub byte_span: ParserByteSpanV0,
216 pub range: ParserRangeV0,
217}
218
219#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
220#[serde(rename_all = "camelCase")]
221pub struct ParserIndexKeyframesFactsV0 {
222 pub names: Vec<String>,
223 pub names_under_media: Vec<String>,
224 pub names_under_supports: Vec<String>,
225 pub names_under_layer: Vec<String>,
226 pub animation_ref_names: Vec<String>,
227 pub animation_name_ref_names: Vec<String>,
228 pub selectors_with_animation_ref_names: Vec<String>,
229 pub selectors_with_animation_name_ref_names: Vec<String>,
230 pub selectors_with_animation_refs_under_media_names: Vec<String>,
231 pub selectors_with_animation_refs_under_supports_names: Vec<String>,
232 pub selectors_with_animation_refs_under_layer_names: Vec<String>,
233 pub selectors_with_animation_name_refs_under_media_names: Vec<String>,
234 pub selectors_with_animation_name_refs_under_supports_names: Vec<String>,
235 pub selectors_with_animation_name_refs_under_layer_names: Vec<String>,
236}
237
238#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
239#[serde(rename_all = "camelCase")]
240pub struct ParserIndexComposesFactsV0 {
241 pub selectors_with_composes_names: Vec<String>,
242 pub selectors_with_composes_under_media_names: Vec<String>,
243 pub selectors_with_composes_under_supports_names: Vec<String>,
244 pub selectors_with_composes_under_layer_names: Vec<String>,
245 pub local_selector_names: Vec<String>,
246 pub imported_selector_names: Vec<String>,
247 pub global_selector_names: Vec<String>,
248 pub local_selector_names_under_media: Vec<String>,
249 pub local_selector_names_under_supports: Vec<String>,
250 pub local_selector_names_under_layer: Vec<String>,
251 pub imported_selector_names_under_media: Vec<String>,
252 pub imported_selector_names_under_supports: Vec<String>,
253 pub imported_selector_names_under_layer: Vec<String>,
254 pub global_selector_names_under_media: Vec<String>,
255 pub global_selector_names_under_supports: Vec<String>,
256 pub global_selector_names_under_layer: Vec<String>,
257 pub import_sources: Vec<String>,
258 pub import_sources_under_media: Vec<String>,
259 pub import_sources_under_supports: Vec<String>,
260 pub import_sources_under_layer: Vec<String>,
261 pub class_name_count: usize,
262 pub local_class_name_count: usize,
263 pub imported_class_name_count: usize,
264 pub global_class_name_count: usize,
265}
266
267#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
268#[serde(rename_all = "camelCase")]
269pub struct ParserIndexWrapperFactsV0 {
270 pub selectors_under_media_names: Vec<String>,
271 pub selectors_under_supports_names: Vec<String>,
272 pub selectors_under_layer_names: Vec<String>,
273}
274
275#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
276#[serde(rename_all = "camelCase")]
277pub struct NestedSafetyCountsV0 {
278 pub flat: usize,
279 pub bem_suffix_safe: usize,
280 pub nested_unsafe: usize,
281}
282
283#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
284#[serde(rename_all = "camelCase")]
285pub struct StyleSemanticFactsV0 {
286 pub selector_identity: StyleSelectorIdentityFactsV0,
287 pub custom_properties: StyleCustomPropertySemanticFactsV0,
288 pub sass: StyleSassSemanticFactsV0,
289 pub context_index: StyleContextIndexV0,
290}
291
292#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
294#[serde(rename_all = "camelCase")]
295pub struct StyleContextIndexV0 {
296 pub schema_version: &'static str,
297 pub product: &'static str,
298 pub layer_index: StyleLayerIndexV0,
299 pub container_index: StyleContainerIndexV0,
300 pub scope_index: StyleScopeIndexV0,
301 pub selector_context_count: usize,
302 pub ready_surfaces: Vec<&'static str>,
303}
304
305#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
307#[serde(rename_all = "camelCase")]
308pub struct StyleLayerIndexV0 {
309 pub statement_layers: Vec<StyleLayerStatementV0>,
310 pub block_layers: Vec<StyleContextBlockV0>,
311 pub selector_memberships: Vec<StyleContextSelectorMembershipV0>,
312 pub named_layer_count: usize,
313 pub anonymous_layer_block_count: usize,
314}
315
316#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize)]
318#[serde(rename_all = "camelCase")]
319pub struct StyleLayerStatementV0 {
320 pub name: String,
321 pub source_order: usize,
322 pub byte_span: ParserByteSpanV0,
323 pub range: ParserRangeV0,
324}
325
326#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
328#[serde(rename_all = "camelCase")]
329pub struct StyleContainerIndexV0 {
330 pub containers: Vec<StyleContextBlockV0>,
331 pub selector_memberships: Vec<StyleContextSelectorMembershipV0>,
332 pub named_container_count: usize,
333 pub anonymous_container_count: usize,
334}
335
336#[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)]
338#[serde(rename_all = "camelCase")]
339pub struct StyleScopeIndexV0 {
340 pub scopes: Vec<StyleContextBlockV0>,
341 pub selector_memberships: Vec<StyleContextSelectorMembershipV0>,
342 pub scoped_selector_count: usize,
343}
344
345#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize)]
347#[serde(rename_all = "camelCase")]
348pub struct StyleContextBlockV0 {
349 pub id: String,
350 pub kind: &'static str,
351 pub name: Option<String>,
352 pub prelude: String,
353 pub source_order: usize,
354 pub byte_span: ParserByteSpanV0,
355 pub range: ParserRangeV0,
356}
357
358#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize)]
360#[serde(rename_all = "camelCase")]
361pub struct StyleContextSelectorMembershipV0 {
362 pub selector_name: String,
363 pub context_id: String,
364 pub context_kind: &'static str,
365 pub source_order: usize,
366}
367
368#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
369#[serde(rename_all = "camelCase")]
370pub struct StyleSelectorIdentityFactsV0 {
371 pub canonical_names: Vec<String>,
372 pub bem_suffix_safe_names: Vec<String>,
373 pub bem_suffix_parent_names: Vec<String>,
374 pub nested_unsafe_names: Vec<String>,
375 pub nested_safety_counts: NestedSafetyCountsV0,
376}
377
378#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
379#[serde(rename_all = "camelCase")]
380pub struct StyleCustomPropertySemanticFactsV0 {
381 pub decl_names: Vec<String>,
382 pub ref_names: Vec<String>,
383 pub resolved_ref_names: Vec<String>,
384 pub unresolved_ref_names: Vec<String>,
385 pub selectors_with_refs_names: Vec<String>,
386}
387
388#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
389#[serde(rename_all = "camelCase")]
390pub struct StyleSassSemanticFactsV0 {
391 pub selector_symbol_facts: Vec<ParserIndexSassSelectorSymbolFactV0>,
392 pub selectors_with_resolved_variable_refs_names: Vec<String>,
393 pub selectors_with_unresolved_variable_refs_names: Vec<String>,
394 pub selectors_with_resolved_mixin_includes_names: Vec<String>,
395 pub selectors_with_unresolved_mixin_includes_names: Vec<String>,
396 pub selectors_with_function_calls_names: Vec<String>,
397 pub same_file_resolution: ParserIndexSassSameFileResolutionFactsV0,
398}