mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-18 16:17:36 +00:00
* implement matchUtilities2 * ensure animation names without keyframes are not prefixed * remove matchBase * call addUtilities for each group individually * WIP: Write plugins using matchUtilities2 * MORE * Fix arbitrary value support for fontSize * Fixes, update fixtures * Rebuild fixtures * Don't generate `divide` class with no modifier * Fixes, rebuild fixtures * Rename matchUtilities2 to matchUtilities * Delete bad tests * Remove temp files GROSS * Clean stuff up * Support no return in matchUtilities Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
42 lines
980 B
JavaScript
42 lines
980 B
JavaScript
import transformThemeValue from '../util/transformThemeValue'
|
|
|
|
let transformValue = transformThemeValue('boxShadow')
|
|
let shadowReset = {
|
|
'*': {
|
|
'--tw-shadow': '0 0 #0000',
|
|
},
|
|
}
|
|
let defaultBoxShadow = [
|
|
`var(--tw-ring-offset-shadow, 0 0 #0000)`,
|
|
`var(--tw-ring-shadow, 0 0 #0000)`,
|
|
`var(--tw-shadow)`,
|
|
].join(', ')
|
|
|
|
export default function () {
|
|
return function ({ config, matchUtilities, addBase, addUtilities, theme, variants }) {
|
|
if (config('mode') === 'jit') {
|
|
addBase(shadowReset)
|
|
} else {
|
|
addUtilities(shadowReset, { respectImportant: false })
|
|
}
|
|
|
|
matchUtilities(
|
|
{
|
|
shadow: (value) => {
|
|
value = transformValue(value)
|
|
|
|
return {
|
|
'--tw-shadow': value === 'none' ? '0 0 #0000' : value,
|
|
'box-shadow': defaultBoxShadow,
|
|
}
|
|
},
|
|
},
|
|
{
|
|
values: theme('boxShadow'),
|
|
variants: variants('boxShadow'),
|
|
type: 'lookup',
|
|
}
|
|
)
|
|
}
|
|
}
|