@@ -30,7 +30,13 @@ const getAdaptivePropSelector = (selector) => {
30
30
31
31
/** @type { import('postcss').PluginCreator<any> }*/
32
32
module . exports = ( options ) => {
33
- const { files, adaptive_prop_selector, custom_selector, layer, ...props } = options
33
+ const {
34
+ files,
35
+ adaptive_prop_selector,
36
+ custom_selector,
37
+ custom_selector_dark,
38
+ layer, ...props
39
+ } = options
34
40
35
41
const FilePropsCache = new Map ( ) ;
36
42
@@ -55,6 +61,7 @@ module.exports = (options) => {
55
61
return {
56
62
Once ( node , { parse, result, Rule, AtRule } ) {
57
63
let target_selector = custom_selector || ':root'
64
+ let target_selector_dark = custom_selector_dark || ':root'
58
65
59
66
if ( ! files && ! Object . keys ( props ) . length ) {
60
67
return console . warn ( 'postcss-jit-props: Variable source(s) not passed.' )
@@ -121,7 +128,7 @@ module.exports = (options) => {
121
128
STATE . mapped_dark = new Set ( )
122
129
123
130
STATE . target_rule = new Rule ( { selector : target_selector , source : node . first . source } )
124
- STATE . target_rule_dark = new Rule ( { selector : target_selector , source : node . first . source } )
131
+ STATE . target_rule_dark = new Rule ( { selector : target_selector_dark , source : node . first . source } )
125
132
STATE . target_media_dark = new AtRule ( { name : 'media' , params : '(prefers-color-scheme: dark)' , source : node . first . source } )
126
133
127
134
if ( layer ) {
0 commit comments