This commit is contained in:
2024-11-24 20:00:29 +01:00
parent e463ca1e7c
commit 33843688d8
8 changed files with 228 additions and 72 deletions
+25
View File
@@ -1,6 +1,31 @@
#[macro_export]
macro_rules! __css {
($_style:expr,)=>{};
// percentage (n%)
(
$_style:expr, $name:ident: $value:literal% $(, $($other:tt)*)?
) => {{
$_style.$name = Number::Pe($value);
$crate::__css!($_style, $($($other)*)?);
}};
(
$_style:expr, ($name:ident): $value:literal% $(, $($other:tt)*)?
) => {{
$_style.other.insert(stringify!($name).to_string(), Box::new(
Number::Pe($value)
));
$crate::__css!($_style, $($($other)*)?);
}};
// Number
(
$_style:expr, $name:ident: $value:literal $(, $($other:tt)*)?
) => {{
$_style.$name = Number::Px($value);
$crate::__css!($_style, $($($other)*)?);
}};
// Normal
(
$_style:expr, $name:ident: $value:expr $(, $($other:tt)*)?
) => {{