-
-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(css_parser): css modules composes (#3017)
- Loading branch information
1 parent
32d73c4
commit 508a914
Showing
39 changed files
with
2,567 additions
and
82 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
crates/biome_css_formatter/src/css/any/composes_import_source.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file. | ||
|
||
use crate::prelude::*; | ||
use biome_css_syntax::AnyCssComposesImportSource; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatAnyCssComposesImportSource; | ||
impl FormatRule<AnyCssComposesImportSource> for FormatAnyCssComposesImportSource { | ||
type Context = CssFormatContext; | ||
fn fmt(&self, node: &AnyCssComposesImportSource, f: &mut CssFormatter) -> FormatResult<()> { | ||
match node { | ||
AnyCssComposesImportSource::CssIdentifier(node) => node.format().fmt(f), | ||
AnyCssComposesImportSource::CssString(node) => node.format().fmt(f), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
crates/biome_css_formatter/src/css/auxiliary/composes_import_specifier.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::prelude::*; | ||
use biome_css_syntax::{CssComposesImportSpecifier, CssComposesImportSpecifierFields}; | ||
use biome_formatter::write; | ||
|
||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssComposesImportSpecifier; | ||
impl FormatNodeRule<CssComposesImportSpecifier> for FormatCssComposesImportSpecifier { | ||
fn fmt_fields( | ||
&self, | ||
node: &CssComposesImportSpecifier, | ||
f: &mut CssFormatter, | ||
) -> FormatResult<()> { | ||
let CssComposesImportSpecifierFields { from_token, source } = node.as_fields(); | ||
|
||
write![f, [space(), from_token.format(), space(), source.format()]] | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
crates/biome_css_formatter/src/css/auxiliary/composes_property_value.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::prelude::*; | ||
use biome_css_syntax::{CssComposesPropertyValue, CssComposesPropertyValueFields}; | ||
use biome_formatter::write; | ||
|
||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssComposesPropertyValue; | ||
impl FormatNodeRule<CssComposesPropertyValue> for FormatCssComposesPropertyValue { | ||
fn fmt_fields( | ||
&self, | ||
node: &CssComposesPropertyValue, | ||
f: &mut CssFormatter, | ||
) -> FormatResult<()> { | ||
let CssComposesPropertyValueFields { classes, specifier } = node.as_fields(); | ||
|
||
write![f, [classes.format(), specifier.format()]] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
crates/biome_css_formatter/src/css/lists/composes_class_list.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::prelude::*; | ||
use biome_css_syntax::CssComposesClassList; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssComposesClassList; | ||
impl FormatRule<CssComposesClassList> for FormatCssComposesClassList { | ||
type Context = CssFormatContext; | ||
fn fmt(&self, node: &CssComposesClassList, f: &mut CssFormatter) -> FormatResult<()> { | ||
f.join_with(&space()) | ||
.entries(node.iter().formatted()) | ||
.finish() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
crates/biome_css_formatter/src/css/properties/composes_property.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use crate::prelude::*; | ||
use biome_css_syntax::{CssComposesProperty, CssComposesPropertyFields}; | ||
use biome_formatter::write; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssComposesProperty; | ||
impl FormatNodeRule<CssComposesProperty> for FormatCssComposesProperty { | ||
fn fmt_fields(&self, node: &CssComposesProperty, f: &mut CssFormatter) -> FormatResult<()> { | ||
let CssComposesPropertyFields { | ||
name, | ||
colon_token, | ||
value, | ||
} = node.as_fields(); | ||
write!( | ||
f, | ||
[name.format(), colon_token.format(), space(), value.format()] | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file. | ||
|
||
pub(crate) mod composes_property; | ||
pub(crate) mod generic_property; | ||
pub(crate) mod value_at_rule_generic_property; |
Oops, something went wrong.