diff --git a/.changeset/fast-ravens-rescue.md b/.changeset/fast-ravens-rescue.md new file mode 100644 index 00000000..d0677808 --- /dev/null +++ b/.changeset/fast-ravens-rescue.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/vite-plugin": patch +--- + +Fix css duplicate issue when exporting diff --git a/.changeset/young-chairs-yawn.md b/.changeset/young-chairs-yawn.md new file mode 100644 index 00000000..9b510f94 --- /dev/null +++ b/.changeset/young-chairs-yawn.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/wasm": patch +--- + +Apply css optimize diff --git a/Cargo.lock b/Cargo.lock index 95424235..c8a6f6ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,9 +399,9 @@ dependencies = [ [[package]] name = "half" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db2ff139bba50379da6aa0766b52fdcb62cb5b263009b09ed58ba604e14bbd1" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" dependencies = [ "cfg-if", "crunchy", diff --git a/apps/vite/src/App.tsx b/apps/vite/src/App.tsx index a980c083..88f55b93 100644 --- a/apps/vite/src/App.tsx +++ b/apps/vite/src/App.tsx @@ -14,6 +14,9 @@ export default function App() { hello + + + typo ) diff --git a/benchmark/next-chakra-ui/package.json b/benchmark/next-chakra-ui/package.json index 4df1f662..181698b8 100644 --- a/benchmark/next-chakra-ui/package.json +++ b/benchmark/next-chakra-ui/package.json @@ -10,7 +10,7 @@ "lint": "next lint" }, "dependencies": { - "@chakra-ui/react": "^3.15.0", + "@chakra-ui/react": "^3.15.1", "@emotion/react": "^11.14.0", "next": "^15.2.4", "next-themes": "^0.4.6", diff --git a/bindings/devup-ui-wasm/src/lib.rs b/bindings/devup-ui-wasm/src/lib.rs index 6673309f..6cbfb559 100644 --- a/bindings/devup-ui-wasm/src/lib.rs +++ b/bindings/devup-ui-wasm/src/lib.rs @@ -13,7 +13,7 @@ static GLOBAL_STYLE_SHEET: Lazy> = #[wasm_bindgen] pub struct Output { code: String, - styles: Vec, + styles: HashSet, } #[wasm_bindgen] extern "C" { diff --git a/libs/css/src/lib.rs b/libs/css/src/lib.rs index be8667f0..4fd13bc2 100644 --- a/libs/css/src/lib.rs +++ b/libs/css/src/lib.rs @@ -372,7 +372,7 @@ fn optimize_color(value: &str) -> String { format!("#{}", ret) } -fn optimize_value(value: &str) -> String { +pub fn optimize_value(value: &str) -> String { let mut ret = value.trim().to_string(); if ret.contains(",") { ret = F_SPACE_RE.replace_all(&ret, ",").trim().to_string(); diff --git a/libs/extractor/src/extract_style/mod.rs b/libs/extractor/src/extract_style/mod.rs index 6c6e61ba..9dd5291c 100644 --- a/libs/extractor/src/extract_style/mod.rs +++ b/libs/extractor/src/extract_style/mod.rs @@ -1,12 +1,13 @@ -use crate::utils::convert_value; use crate::StyleProperty; +use crate::utils::convert_value; use css::{ - css_to_classname, sheet_to_classname, sheet_to_variable_name, short_to_long, StyleSelector, + StyleSelector, css_to_classname, optimize_value, sheet_to_classname, sheet_to_variable_name, + short_to_long, }; use once_cell::sync::Lazy; use std::collections::HashSet; -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub struct ExtractStaticStyle { /// property property: String, @@ -46,11 +47,11 @@ impl ExtractStaticStyle { /// create a new ExtractStaticStyle pub fn new(property: &str, value: &str, level: u8, selector: Option) -> Self { Self { - value: if MAINTAIN_VALUE_PROPERTIES.contains(property) { + value: optimize_value(&if MAINTAIN_VALUE_PROPERTIES.contains(property) { value.to_string() } else { convert_value(value) - }, + }), property: short_to_long(property), level, selector, @@ -65,11 +66,11 @@ impl ExtractStaticStyle { selector: Option, ) -> Self { Self { - value: if MAINTAIN_VALUE_PROPERTIES.contains(property) { + value: optimize_value(&if MAINTAIN_VALUE_PROPERTIES.contains(property) { value.to_string() } else { convert_value(value) - }, + }), property: property.to_string(), level, selector, @@ -109,20 +110,19 @@ impl ExtractStyleProperty for ExtractStaticStyle { StyleProperty::ClassName(sheet_to_classname( self.property.as_str(), self.level, - Some( - if MAINTAIN_VALUE_PROPERTIES.contains(self.property.as_str()) { + Some(&optimize_value( + &if MAINTAIN_VALUE_PROPERTIES.contains(self.property.as_str()) { self.value.to_string() } else { convert_value(self.value.as_str()) - } - .as_str(), - ), + }, + )), s.as_deref(), self.style_order, )) } } -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub struct ExtractCss { /// css code pub css: String, @@ -135,7 +135,7 @@ impl ExtractStyleProperty for ExtractCss { } } -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub struct ExtractDynamicStyle { /// property property: String, @@ -207,7 +207,7 @@ impl ExtractStyleProperty for ExtractDynamicStyle { } } } -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub enum ExtractStyleValue { Static(ExtractStaticStyle), Typography(String), diff --git a/libs/extractor/src/lib.rs b/libs/extractor/src/lib.rs index 8b059780..64c0753c 100644 --- a/libs/extractor/src/lib.rs +++ b/libs/extractor/src/lib.rs @@ -14,7 +14,7 @@ use oxc_ast_visit::VisitMut; use oxc_codegen::Codegen; use oxc_parser::{Parser, ParserReturn}; use oxc_span::SourceType; -use std::collections::BTreeMap; +use std::collections::{BTreeMap, HashSet}; use std::error::Error; #[derive(Debug)] pub enum ExtractStyleProp<'a> { @@ -73,10 +73,10 @@ pub enum StyleProperty { }, } -#[derive(Debug, PartialEq)] +#[derive(Debug)] pub struct ExtractOutput { // used styles - pub styles: Vec, + pub styles: HashSet, // output source pub code: String, @@ -96,7 +96,7 @@ pub fn extract( if !code.contains(option.package.as_str()) { // skip if not using package return Ok(ExtractOutput { - styles: vec![], + styles: HashSet::new(), code: code.to_string(), }); } @@ -128,16 +128,40 @@ pub fn extract( #[cfg(test)] mod tests { + use std::collections::BTreeSet; + use super::*; use css::reset_class_map; use insta::assert_debug_snapshot; use serial_test::serial; + #[derive(Debug)] + #[allow(dead_code)] + struct ToBTreeSet { + // used styles + pub(crate) styles: BTreeSet, + + // output source + pub(crate) code: String, + } + + impl From for ToBTreeSet { + fn from(output: ExtractOutput) -> Self { + Self { + styles: { + let mut set = BTreeSet::new(); + set.extend(output.styles); + set + }, + code: output.code, + } + } + } #[test] #[serial] fn extract_just_tsx() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", "const a = 1;", @@ -147,10 +171,10 @@ mod tests { }, ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", "", @@ -160,26 +184,28 @@ mod tests { }, ) .unwrap() - ); + )); } #[test] #[serial] fn ignore_special_props() { reset_class_map(); - assert_debug_snapshot!(extract( - "test.tsx", - r#"import {Box} from '@devup-ui/core' + assert_debug_snapshot!(ToBTreeSet::from( + extract( + "test.tsx", + r#"import {Box} from '@devup-ui/core' {}} aria-valuenow={24} key={2} tabIndex={1} id="id" /> "#, - ExtractOption { - package: "@devup-ui/core".to_string(), - css_file: None - } - ) - .unwrap()); + ExtractOption { + package: "@devup-ui/core".to_string(), + css_file: None + } + ) + .unwrap() + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Input} from '@devup-ui/core' @@ -191,14 +217,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn convert_tag() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -210,10 +236,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -225,8 +251,8 @@ mod tests { } ) .unwrap() - ); - assert_debug_snapshot!( + )); + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -238,7 +264,7 @@ mod tests { } ) .unwrap() - ); + )); // assert_debug_snapshot!(extract( // "test.tsx", // r#"import {Box} from '@devup-ui/core' @@ -289,7 +315,7 @@ mod tests { #[serial] fn extract_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -301,9 +327,9 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box as C} from '@devup-ui/core' @@ -315,9 +341,9 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Input} from '@devup-ui/core' @@ -329,10 +355,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Button} from '@devup-ui/core' @@ -344,10 +370,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Flex} from '@devup-ui/core' @@ -359,10 +385,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Flex} from '@devup-ui/core' @@ -374,14 +400,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_style_props_with_class_name() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -393,10 +419,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -408,10 +434,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -423,10 +449,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -438,9 +464,9 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -452,10 +478,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Image} from '@devup-ui/core' @@ -473,14 +499,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_class_name_from_component() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {VStack as C} from '@devup-ui/core' @@ -492,13 +518,13 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_responsive_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -510,8 +536,8 @@ mod tests { } ) .unwrap() - ); - assert_debug_snapshot!( + )); + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Flex } from "@devup-ui/core"; @@ -523,14 +549,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_dynamic_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -542,10 +568,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -557,10 +583,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -572,10 +598,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -587,14 +613,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_dynamic_style_props_with_type() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -606,10 +632,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -621,10 +647,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -636,14 +662,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_dynamic_responsive_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -655,14 +681,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_compound_responsive_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -674,14 +700,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_wrong_responsive_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -693,14 +719,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_variable_style_props_with_style() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -712,10 +738,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -727,14 +753,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_conditional_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -746,10 +772,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -761,10 +787,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -776,10 +802,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -791,10 +817,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -806,10 +832,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -821,10 +847,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -836,10 +862,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -851,14 +877,29 @@ mod tests { } ) .unwrap() - ); + )); + + reset_class_map(); + assert_debug_snapshot!(ToBTreeSet::from( + extract( + "test.tsx", + r#"import { Box } from "@devup-ui/core"; +; +"#, + ExtractOption { + package: "@devup-ui/core".to_string(), + css_file: None + } + ) + .unwrap() + )); } #[test] #[serial] fn extract_responsive_conditional_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -870,10 +911,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -885,10 +926,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -900,10 +941,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -915,10 +956,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -930,10 +971,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -945,9 +986,10 @@ mod tests { } ) .unwrap() - ); + )); + reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -959,10 +1001,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -974,14 +1016,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_logical_case() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -993,10 +1035,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1008,10 +1050,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1023,10 +1065,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1038,13 +1080,13 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_responsive_conditional_style_props_with_class_name() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1056,10 +1098,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1071,14 +1113,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1092,14 +1134,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_conditional_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1113,10 +1155,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1130,10 +1172,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1145,10 +1187,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1163,14 +1205,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_selector_with_responsive() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1184,10 +1226,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1203,14 +1245,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_static_css_class_name_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1224,10 +1266,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css as c } from "@devup-ui/core"; @@ -1241,10 +1283,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1259,10 +1301,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css as c } from "@devup-ui/core"; @@ -1276,10 +1318,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1296,10 +1338,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1311,10 +1353,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1326,10 +1368,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1341,14 +1383,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_static_css_with_theme() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -1360,10 +1402,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -1375,10 +1417,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -1390,14 +1432,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn apply_typography() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1409,10 +1451,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1424,10 +1466,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1439,13 +1481,13 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn apply_var_typography() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1457,10 +1499,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1472,10 +1514,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1487,7 +1529,7 @@ mod tests { } ) .unwrap() - ); + )); } #[test] @@ -1528,7 +1570,7 @@ mod tests { #[serial] fn import_wrong_component() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {W} from '@devup-ui/core' @@ -1539,14 +1581,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn support_transpile_mjs() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.mjs", r#"import { jsxs as r, jsx as e } from "react/jsx-runtime"; @@ -1577,10 +1619,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import { jsxs as r, jsx as e } from "react/jsx-runtime"; @@ -1611,14 +1653,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn support_transpile_cjs() { reset_class_map(); - assert_debug_snapshot!(extract( + assert_debug_snapshot!(ToBTreeSet::from(extract( "test.cjs", r#""use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("@devup-ui/react");function t(){return e.jsxs("div",{children:[e.jsx(r.Box,{_hover:{bg:"blue"},bg:"$text",color:"red",children:"hello"}),e.jsx(r.Text,{typography:"header",children:"typo"}),e.jsx(r.Flex,{as:"section",mt:2,children:"section"})]})}exports.Lib=t;"#, ExtractOption { @@ -1626,10 +1668,10 @@ export { css_file: None } ) - .unwrap()); + .unwrap())); reset_class_map(); - assert_debug_snapshot!(extract( + assert_debug_snapshot!(ToBTreeSet::from(extract( "test.cjs", r#""use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const {jsx:e1, jsxs:e2}=require("react/jsx-runtime"),r=require("@devup-ui/react");function t(){return e2("div",{children:[e1(r.Box,{_hover:{bg:"blue"},bg:"$text",color:"red",children:"hello"}),e1(r.Text,{typography:"header",children:"typo"}),e1(r.Flex,{as:"section",mt:2,children:"section"})]})}exports.Lib=t;"#, ExtractOption { @@ -1637,10 +1679,10 @@ export { css_file: None } ) - .unwrap()); + .unwrap())); reset_class_map(); - assert_debug_snapshot!(extract( + assert_debug_snapshot!(ToBTreeSet::from(extract( "test.js", r#""use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("@devup-ui/react");function t(){return e.jsxs("div",{children:[e.jsx(r.Box,{_hover:{bg:"blue"},bg:"$text",color:"red",children:"hello"}),e.jsx(r.Text,{typography:"header",children:"typo"}),e.jsx(r.Flex,{as:"section",mt:2,children:"section"})]})}exports.Lib=t;"#, ExtractOption { @@ -1648,14 +1690,14 @@ export { css_file: None } ) - .unwrap()); + .unwrap())); } #[test] #[serial] fn maintain_value() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1667,14 +1709,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn ternary_operator_in_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1686,10 +1728,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1701,10 +1743,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1716,14 +1758,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn test_rest_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1735,14 +1777,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_wrong_direct_array_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1754,10 +1796,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1769,10 +1811,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1784,10 +1826,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1799,13 +1841,13 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn negative_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1817,10 +1859,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1832,10 +1874,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1847,10 +1889,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1862,10 +1904,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1877,10 +1919,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1892,10 +1934,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1907,14 +1949,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_wrong_direct_object_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1926,10 +1968,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1941,10 +1983,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1956,10 +1998,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1971,14 +2013,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_array_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1990,10 +2032,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2005,10 +2047,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2020,10 +2062,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2035,10 +2077,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Center} from '@devup-ui/core' @@ -2053,10 +2095,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2068,10 +2110,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2083,14 +2125,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_object_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2102,10 +2144,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2117,10 +2159,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2132,10 +2174,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2147,14 +2189,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_variable_object_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2166,9 +2208,9 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2180,14 +2222,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_object_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2199,10 +2241,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2214,13 +2256,13 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_variable_object_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2232,14 +2274,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_array_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2251,10 +2293,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2266,13 +2308,13 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_variable_array_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2284,14 +2326,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_hybrid_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2303,13 +2345,13 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn test_component_in_func() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2326,14 +2368,14 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); } #[test] #[serial] fn backtick_prop() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2345,10 +2387,10 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2360,14 +2402,14 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); } #[test] #[serial] fn group_selector_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2379,14 +2421,14 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); } #[test] #[serial] fn test_duplicate_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2398,14 +2440,14 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); } #[test] #[serial] fn avoid_same_name_component() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2419,14 +2461,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn css_props_destructuring_assignment() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {css} from '@devup-ui/core' @@ -2441,10 +2483,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {css} from '@devup-ui/core' @@ -2459,14 +2501,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn theme_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2478,14 +2520,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn template_literal_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2497,10 +2539,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2512,10 +2554,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2527,10 +2569,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2542,14 +2584,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn theme_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2561,9 +2603,9 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2575,10 +2617,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2597,14 +2639,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn custom_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2620,10 +2662,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2639,10 +2681,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2658,14 +2700,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn style_order() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2681,10 +2723,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.mjs", r#"import { jsxs as r, jsx as e } from "react/jsx-runtime"; @@ -2716,10 +2758,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2731,10 +2773,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2746,10 +2788,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2761,10 +2803,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2783,10 +2825,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2806,6 +2848,6 @@ export { } ) .unwrap() - ); + )); } } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_typography-2.snap b/libs/extractor/src/snapshots/extractor__tests__apply_typography-2.snap index 84bffb23..96205e24 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_typography-2.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_typography-2.snap @@ -1,12 +1,12 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [ +ToBTreeSet { + styles: { Typography( "bold", ), - ], + }, code: "import \"@devup-ui/core/devup-ui.css\";\n;\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_typography-3.snap b/libs/extractor/src/snapshots/extractor__tests__apply_typography-3.snap index f3f6128f..d91897e2 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_typography-3.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_typography-3.snap @@ -1,15 +1,15 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [ +ToBTreeSet { + styles: { Typography( "bold", ), Typography( "bold2", ), - ], + }, code: "import \"@devup-ui/core/devup-ui.css\";\n;\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_typography.snap b/libs/extractor/src/snapshots/extractor__tests__apply_typography.snap index aae74d9d..70a43587 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_typography.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_typography.snap @@ -1,12 +1,12 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [ +ToBTreeSet { + styles: { Typography( "bold", ), - ], + }, code: "import \"@devup-ui/core/devup-ui.css\";\n;\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-2.snap b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-2.snap index 32088fdd..15555283 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-2.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-2.snap @@ -1,8 +1,8 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [], +ToBTreeSet { + styles: {}, code: ";\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-3.snap b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-3.snap index b71a0e7b..2edef42f 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-3.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-3.snap @@ -1,8 +1,8 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [], +ToBTreeSet { + styles: {}, code: ";\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography.snap b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography.snap index 9a7e9ae5..4040f940 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography.snap @@ -1,8 +1,8 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [], +ToBTreeSet { + styles: {}, code: ";\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__avoid_same_name_component.snap b/libs/extractor/src/snapshots/extractor__tests__avoid_same_name_component.snap index f86815af..772c8d8d 100644 --- a/libs/extractor/src/snapshots/extractor__tests__avoid_same_name_component.snap +++ b/libs/extractor/src/snapshots/extractor__tests__avoid_same_name_component.snap @@ -1,9 +1,9 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.js\",\nr#\"import {Box} from '@devup-ui/core'\nimport {Button} from '@devup/ui'\n ;\n ;