2021-06-24 17:01:36 -04:00
|
|
|
import { addBaseSelector } from './filter'
|
|
|
|
|
|
2021-04-04 19:09:34 -04:00
|
|
|
export default function () {
|
2021-06-24 17:01:36 -04:00
|
|
|
return function ({ config, matchUtilities, theme, variants, memory }) {
|
|
|
|
|
if (config('mode') === 'jit') {
|
|
|
|
|
matchUtilities(
|
|
|
|
|
{
|
|
|
|
|
brightness: (value, { selector }) => {
|
|
|
|
|
addBaseSelector(memory, selector)
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
'--tw-brightness': `brightness(${value})`,
|
|
|
|
|
filter: 'var(--tw-filter)',
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-04-04 19:09:34 -04:00
|
|
|
},
|
2021-06-24 17:01:36 -04:00
|
|
|
{
|
|
|
|
|
values: theme('brightness'),
|
|
|
|
|
variants: variants('brightness'),
|
|
|
|
|
type: 'any',
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
matchUtilities(
|
|
|
|
|
{
|
|
|
|
|
brightness: (value) => {
|
|
|
|
|
return {
|
|
|
|
|
'--tw-brightness': `brightness(${value})`,
|
|
|
|
|
...(config('mode') === 'jit' ? { filter: 'var(--tw-filter)' } : {}),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
values: theme('brightness'),
|
|
|
|
|
variants: variants('brightness'),
|
|
|
|
|
type: 'any',
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
2021-04-04 19:09:34 -04:00
|
|
|
}
|
|
|
|
|
}
|