fix: repeating non-parent selectors

This commit is contained in:
yiffyrusdev 2024-12-14 10:21:41 +05:00
commit ad34a0e78a
No known key found for this signature in database
GPG key ID: FB83DFEAFB3F4709
4 changed files with 63 additions and 15 deletions

View file

@ -112,7 +112,8 @@ pub fn styly_macro_impl(input: TokenStream, source_path: Option<PathBuf>) -> Tok
let scope_members = scope let scope_members = scope
.hashed_selectors .hashed_selectors
.iter() .iter()
.unique() // not pretty sure about the best way to do this
.unique_by(|hs| hs.sel.as_arbitrary().ident.clone())
.filter_map(|hs| { .filter_map(|hs| {
hs.html_ident.clone().map(|html| { hs.html_ident.clone().map(|html| {
let name = match hs.sel { let name = match hs.sel {

View file

@ -7,6 +7,13 @@
&__blist { &__blist {
list-style: none; list-style: none;
} }
&.sub {
margin: 0;
}
.bus & {
padding: 0;
}
} }
.el2 { .el2 {
@ -21,4 +28,12 @@
background: black; background: black;
} }
} }
&.sub {
margin: 0;
}
.bus {
margin: 0;
}
} }

View file

@ -538,34 +538,50 @@ snapshot_kind: text
background: #000; background: #000;
} }
.YYYksiQMfU3exD720ckMbA.el1 { .n9m9Me_zRl6xP8NIGObY_A.el1 {
color: red; color: red;
} }
.YYYksiQMfU3exD720ckMbA.el1-mob { .n9m9Me_zRl6xP8NIGObY_A.el1-mob {
color: #00f; color: #00f;
} }
.YYYksiQMfU3exD720ckMbA.el1__blist { .n9m9Me_zRl6xP8NIGObY_A.el1__blist {
list-style: none; list-style: none;
} }
.YYYksiQMfU3exD720ckMbA.el2 { .n9m9Me_zRl6xP8NIGObY_A.el1.n9m9Me_zRl6xP8NIGObY_A.sub {
margin: 0;
}
.n9m9Me_zRl6xP8NIGObY_A.bus .n9m9Me_zRl6xP8NIGObY_A.el1 {
padding: 0;
}
.n9m9Me_zRl6xP8NIGObY_A.el2 {
color: #fff; color: #fff;
} }
.YYYksiQMfU3exD720ckMbA.el2-mob { .n9m9Me_zRl6xP8NIGObY_A.el2-mob {
color: #000; color: #000;
} }
.YYYksiQMfU3exD720ckMbA.el2__blist { .n9m9Me_zRl6xP8NIGObY_A.el2__blist {
background: #fff; background: #fff;
} }
.YYYksiQMfU3exD720ckMbA.el2__blist-mob { .n9m9Me_zRl6xP8NIGObY_A.el2__blist-mob {
background: #000; background: #000;
} }
.n9m9Me_zRl6xP8NIGObY_A.el2.n9m9Me_zRl6xP8NIGObY_A.sub {
margin: 0;
}
.n9m9Me_zRl6xP8NIGObY_A.el2 .n9m9Me_zRl6xP8NIGObY_A.bus {
margin: 0;
}
.wZIQboPSLZ8aKu0MjXHwYg.p1 { .wZIQboPSLZ8aKu0MjXHwYg.p1 {
font-size: 10px; font-size: 10px;
color: #fff; color: #fff;

View file

@ -4,30 +4,46 @@ assertion_line: 172
input_file: tests/sabry_output/scopes/repeating_selector_scss.css input_file: tests/sabry_output/scopes/repeating_selector_scss.css
snapshot_kind: text snapshot_kind: text
--- ---
.YYYksiQMfU3exD720ckMbA.el1 { .n9m9Me_zRl6xP8NIGObY_A.el1 {
color: red; color: red;
} }
.YYYksiQMfU3exD720ckMbA.el1-mob { .n9m9Me_zRl6xP8NIGObY_A.el1-mob {
color: #00f; color: #00f;
} }
.YYYksiQMfU3exD720ckMbA.el1__blist { .n9m9Me_zRl6xP8NIGObY_A.el1__blist {
list-style: none; list-style: none;
} }
.YYYksiQMfU3exD720ckMbA.el2 { .n9m9Me_zRl6xP8NIGObY_A.el1.n9m9Me_zRl6xP8NIGObY_A.sub {
margin: 0;
}
.n9m9Me_zRl6xP8NIGObY_A.bus .n9m9Me_zRl6xP8NIGObY_A.el1 {
padding: 0;
}
.n9m9Me_zRl6xP8NIGObY_A.el2 {
color: #fff; color: #fff;
} }
.YYYksiQMfU3exD720ckMbA.el2-mob { .n9m9Me_zRl6xP8NIGObY_A.el2-mob {
color: #000; color: #000;
} }
.YYYksiQMfU3exD720ckMbA.el2__blist { .n9m9Me_zRl6xP8NIGObY_A.el2__blist {
background: #fff; background: #fff;
} }
.YYYksiQMfU3exD720ckMbA.el2__blist-mob { .n9m9Me_zRl6xP8NIGObY_A.el2__blist-mob {
background: #000; background: #000;
} }
.n9m9Me_zRl6xP8NIGObY_A.el2.n9m9Me_zRl6xP8NIGObY_A.sub {
margin: 0;
}
.n9m9Me_zRl6xP8NIGObY_A.el2 .n9m9Me_zRl6xP8NIGObY_A.bus {
margin: 0;
}