-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 增加 box-orient 解析 && display 增加 -webkit-box 解析
- Loading branch information
Showing
9 changed files
with
230 additions
and
142 deletions.
There are no files selected for viewing
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,3 +1,4 @@ | ||
{ | ||
"rust-analyzer.showUnlinkedFileNotification": false | ||
"rust-analyzer.showUnlinkedFileNotification": false, | ||
"editor.tabSize": 2 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use lightningcss::properties::{flex::BoxOrient as CSSBoxOrient, Property}; | ||
use crate::{generate_expr_enum, style_propetries::style_property_enum}; | ||
|
||
use super::{style_property_type::CSSPropertyType, traits::ToExpr, unit::PropertyTuple}; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct BoxOrient { | ||
pub id: String, | ||
pub value: EnumValue | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub enum EnumValue { | ||
Horizontal, | ||
Vertical, | ||
InlineAxis, | ||
BlockAxis, | ||
} | ||
|
||
impl From<(String, &Property<'_>)> for BoxOrient { | ||
fn from(prop: (String, &Property<'_>)) -> Self { | ||
BoxOrient { | ||
id: prop.0, | ||
value: match prop.1 { | ||
Property::BoxOrient(value, _) => { | ||
match value { | ||
CSSBoxOrient::Horizontal => EnumValue::Horizontal, | ||
CSSBoxOrient::Vertical => EnumValue::Vertical, | ||
CSSBoxOrient::InlineAxis => EnumValue::InlineAxis, | ||
CSSBoxOrient::BlockAxis => EnumValue::BlockAxis, | ||
} | ||
} | ||
_ => EnumValue::InlineAxis, | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl ToExpr for BoxOrient { | ||
fn to_expr(&self) -> PropertyTuple { | ||
PropertyTuple::One( | ||
CSSPropertyType::BoxOrient, | ||
{ | ||
match self.value { | ||
EnumValue::Horizontal => generate_expr_enum!(style_property_enum::BoxOrient::Horizontal), | ||
EnumValue::Vertical => generate_expr_enum!(style_property_enum::BoxOrient::Vertical), | ||
EnumValue::InlineAxis => generate_expr_enum!(style_property_enum::BoxOrient::InlineAxis), | ||
EnumValue::BlockAxis => generate_expr_enum!(style_property_enum::BoxOrient::BlockAxis), | ||
} | ||
} | ||
) | ||
} | ||
} |
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
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
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
Oops, something went wrong.