File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,10 @@ function extractStyles(styles, ast) {
128
128
return false ;
129
129
}
130
130
131
+ if ( selector . includes ( '[data-' ) && ! selector . includes ( '[data-color-mode' ) ) {
132
+ return false ;
133
+ }
134
+
131
135
const tag = selector . match ( / ^ \w [ - \w ] + / ) ;
132
136
if ( tag && ! ALLOW_TAGS . has ( tag [ 0 ] ) ) {
133
137
return false ;
@@ -154,6 +158,10 @@ function extractStyles(styles, ast) {
154
158
return selector . slice ( 5 ) ;
155
159
}
156
160
161
+ if ( selector . startsWith ( ':root ' ) ) {
162
+ return selector . slice ( 6 ) ;
163
+ }
164
+
157
165
return selector ;
158
166
}
159
167
@@ -174,7 +182,7 @@ function extractStyles(styles, ast) {
174
182
function classifyRules ( rules ) {
175
183
function extractTheme ( rule ) {
176
184
for ( const selector of rule . selectors ) {
177
- const match = / - t h e m e \* = ( \w + ) / . exec ( selector ) ;
185
+ const match = / (?: - t h e m e \* | d a t a - c o l o r - m o d e ) = ( \w + ) / . exec ( selector ) ;
178
186
if ( match ) {
179
187
return match [ 1 ] ;
180
188
}
You can’t perform that action at this time.
0 commit comments