Skip to content

Commit 60cf024

Browse files
authored
feat(css): add support for modern CSS properties, pseudo-classes, and pseudo-elements (#9490)
Signed-off-by: will Farrell <willfarrell@proton.me>
1 parent 25fd5fd commit 60cf024

8 files changed

Lines changed: 71 additions & 2 deletions

File tree

.changeset/modern-css-keywords.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Added support for modern CSS properties, pseudo-classes, and pseudo-elements.
6+
7+
New known properties: `dynamic-range-limit`, `overlay`, `reading-flow`, `reading-order`, `scroll-marker-group`, `scroll-target-group`.
8+
9+
New pseudo-elements: `::checkmark`, `::column`, `::picker`, `::picker-icon`, `::scroll-button`, `::scroll-marker`, `::scroll-marker-group`.
10+
11+
New pseudo-classes: `:active-view-transition-type`, `:has-slotted`, `:target-after`, `:target-before`, `:target-current`.

crates/biome_css_analyze/src/keywords.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,17 +851,24 @@ pub const VENDOR_SPECIFIC_PSEUDO_ELEMENTS: [&str; 66] = [
851851

852852
pub const SHADOW_TREE_PSEUDO_ELEMENTS: [&str; 1] = ["part"];
853853

854-
pub const OTHER_PSEUDO_ELEMENTS: [&str; 22] = [
854+
pub const OTHER_PSEUDO_ELEMENTS: [&str; 29] = [
855855
"backdrop",
856+
"checkmark",
857+
"column",
856858
"content",
857859
"cue",
858860
"details-content",
859861
"file-selector-button",
860862
"grammar-error",
861863
"highlight",
862864
"marker",
865+
"picker",
866+
"picker-icon",
863867
"placeholder",
864868
"prefix",
869+
"scroll-button",
870+
"scroll-marker",
871+
"scroll-marker-group",
865872
"search-text",
866873
"selection",
867874
"shadow",
@@ -930,9 +937,10 @@ pub const RESOURCE_STATE_PSEUDO_CLASSES: [&str; 7] = [
930937
"volume-locked",
931938
];
932939

933-
pub const OTHER_PSEUDO_CLASSES: [&str; 52] = [
940+
pub const OTHER_PSEUDO_CLASSES: [&str; 57] = [
934941
"active",
935942
"active-view-transition",
943+
"active-view-transition-type",
936944
"any-link",
937945
"autofill",
938946
"blank",
@@ -951,6 +959,7 @@ pub const OTHER_PSEUDO_CLASSES: [&str; 52] = [
951959
"fullscreen",
952960
"fullscreen-ancestor",
953961
"future",
962+
"has-slotted",
954963
"host",
955964
"host-context",
956965
"hover",
@@ -977,6 +986,9 @@ pub const OTHER_PSEUDO_CLASSES: [&str; 52] = [
977986
"scope",
978987
"state",
979988
"target",
989+
"target-after",
990+
"target-before",
991+
"target-current",
980992
"unresolved",
981993
"user-invalid",
982994
"user-valid",
@@ -1156,6 +1168,7 @@ pub const KNOWN_PROPERTIES: &[&str] = &[
11561168
"direction",
11571169
"display",
11581170
"dominant-baseline",
1171+
"dynamic-range-limit",
11591172
"elevation",
11601173
"empty-cells",
11611174
"field-sizing",
@@ -1374,6 +1387,7 @@ pub const KNOWN_PROPERTIES: &[&str] = &[
13741387
"overflow-wrap",
13751388
"overflow-x",
13761389
"overflow-y",
1390+
"overlay",
13771391
"overscroll-behavior",
13781392
"overscroll-behavior-block",
13791393
"overscroll-behavior-inline",
@@ -1416,6 +1430,8 @@ pub const KNOWN_PROPERTIES: &[&str] = &[
14161430
"print-color-adjust",
14171431
"property-name",
14181432
"quotes",
1433+
"reading-flow",
1434+
"reading-order",
14191435
"region-fragment",
14201436
"resize",
14211437
"rest",
@@ -1443,6 +1459,7 @@ pub const KNOWN_PROPERTIES: &[&str] = &[
14431459
"scroll-margin-left",
14441460
"scroll-margin-right",
14451461
"scroll-margin-top",
1462+
"scroll-marker-group",
14461463
"scroll-padding",
14471464
"scroll-padding-block",
14481465
"scroll-padding-block-end",
@@ -1458,6 +1475,7 @@ pub const KNOWN_PROPERTIES: &[&str] = &[
14581475
"scroll-snap-stop",
14591476
"scroll-snap-type",
14601477
"scroll-start-target",
1478+
"scroll-target-group",
14611479
"scroll-timeline",
14621480
"scroll-timeline-axis",
14631481
"scroll-timeline-name",

crates/biome_css_analyze/tests/specs/correctness/noUnknownProperty/valid.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ a {
6868
color: yellow;
6969
}
7070

71+
/* Scroll and modern CSS properties */
72+
a { scroll-marker-group: after; }
73+
a { scroll-target-group: auto; }
74+
a { reading-flow: flex-visual; }
75+
a { reading-order: 1; }
76+
a { overlay: auto; }
77+
a { dynamic-range-limit: standard; }
78+
7179
/* View Transition navigation property (should not be flagged) */
7280
view-transition {
7381
navigation: auto;

crates/biome_css_analyze/tests/specs/correctness/noUnknownProperty/valid.css.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ a {
7474
color: yellow;
7575
}
7676
77+
/* Scroll and modern CSS properties */
78+
a { scroll-marker-group: after; }
79+
a { scroll-target-group: auto; }
80+
a { reading-flow: flex-visual; }
81+
a { reading-order: 1; }
82+
a { overlay: auto; }
83+
a { dynamic-range-limit: standard; }
84+
7785
/* View Transition navigation property (should not be flagged) */
7886
view-transition {
7987
navigation: auto;

crates/biome_css_analyze/tests/specs/correctness/noUnknownPseudoClass/valid.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ a:defined { }
4040
dialog:open {}
4141
custom-selector:state(checked) {}
4242
:active-view-transition * { transition-duration: 0s; }
43+
::scroll-marker:target-current {}
44+
::scroll-marker:target-before {}
45+
::scroll-marker:target-after {}
46+
slot:has-slotted {}
47+
html:active-view-transition-type(slide) {}

crates/biome_css_analyze/tests/specs/correctness/noUnknownPseudoClass/valid.css.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ a:defined { }
4646
dialog:open {}
4747
custom-selector:state(checked) {}
4848
:active-view-transition * { transition-duration: 0s; }
49+
::scroll-marker:target-current {}
50+
::scroll-marker:target-before {}
51+
::scroll-marker:target-after {}
52+
slot:has-slotted {}
53+
html:active-view-transition-type(slide) {}
4954
5055
```
5156

crates/biome_css_analyze/tests/specs/correctness/noUnknownPseudoElement/valid.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,10 @@ a::part(shadow-part) { }
3636
position: absolute;
3737
}
3838
details::details-content {}
39+
select::picker(select) {}
40+
option::checkmark {}
41+
select::picker-icon {}
42+
.carousel::scroll-marker {}
43+
.carousel::scroll-marker-group {}
44+
.carousel::scroll-button(inline-start) {}
45+
.multicol::column {}

crates/biome_css_analyze/tests/specs/correctness/noUnknownPseudoElement/valid.css.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ a::part(shadow-part) { }
4242
position: absolute;
4343
}
4444
details::details-content {}
45+
select::picker(select) {}
46+
option::checkmark {}
47+
select::picker-icon {}
48+
.carousel::scroll-marker {}
49+
.carousel::scroll-marker-group {}
50+
.carousel::scroll-button(inline-start) {}
51+
.multicol::column {}
4552
4653
```
4754

0 commit comments

Comments
 (0)