From 6303dbe53047fbea98c76fa7391d3b5ebaffb14a Mon Sep 17 00:00:00 2001 From: "ext.yangguangxu3" Date: Tue, 3 Sep 2024 19:53:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0css=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E9=80=8F=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/parse_style_properties.rs | 12 +++++++-- src/style_parser.rs | 11 +++++++-- src/style_propetries/background.rs | 1 + src/style_propetries/style_value_type.rs | 17 ++++++++++++- src/style_propetries/unit.rs | 3 ++- src/visitor.rs | 31 +++++++++++++++++++++++- 6 files changed, 68 insertions(+), 7 deletions(-) diff --git a/src/parse_style_properties.rs b/src/parse_style_properties.rs index 97176ae..481ed4f 100644 --- a/src/parse_style_properties.rs +++ b/src/parse_style_properties.rs @@ -1,8 +1,8 @@ -use lightningcss::{properties::{custom::TokenOrValue, Property}, stylesheet::PrinterOptions}; +use lightningcss::{properties::{custom::TokenOrValue, Property}, stylesheet::PrinterOptions, traits::ToCss}; use swc_core::{common::DUMMY_SP, ecma::{ast::{self}, utils::quote_ident}}; use swc_core::ecma::ast::*; - +use crate::style_propetries::style_value_type::{Variable}; use crate::{generate_expr_lit_str, style_parser::KeyFrameItem, style_propetries::{animation::Animation, animation_multi::AnimationMulti, aspect_ratio::AspectRatio, background::Background, background_image::BackgroundImage, background_position::BackgroundPosition, background_repeat::BackgroundRepeat, background_size::BackgroundSize, border::Border, border_color::BorderColor, border_radius::BorderRadius, border_style::BorderStyle, border_width::BorderWidth, box_shadow::BoxShadow, color::ColorProperty, display::Display, expr::Expr, flex::Flex, flex_align::FlexAlign, flex_basis::FlexBasis, flex_direction::FlexDirection, flex_wrap::FlexWrap, font_size::FontSize, font_style::FontStyle, font_weight::FontWeight, gap::Gap, item_align::ItemAlign, length_value::LengthValueProperty, letter_spacing::LetterSpacing, line_height::LineHeight, marin_padding::MarginPadding, max_size::MaxSizeProperty, normal::Normal, number::NumberProperty, opacity::Opacity, overflow::Overflow, position::Position, size::SizeProperty, style_property_type::{string_to_css_property_type, CSSPropertyType}, style_value_type::StyleValueType, text_align::TextAlign, text_decoration::TextDecoration, text_overflow::TextOverflow, text_shadow::TextShadow, text_transform::TextTransform, transform::Transform, transform_origin::TransformOrigin, transition::Transition, unit::{generate_expr_by_length_value, Platform}, vertical_align::VerticalAlign, visibility::Visibility, white_space::WhiteSpace, word_break::WordBreak}, utils::lowercase_first}; pub fn parse_style_properties(properties: &Vec<(String, Property)>) -> Vec { @@ -25,6 +25,14 @@ pub fn parse_style_properties(properties: &Vec<(String, Property)>) -> Vec