forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdropShadow.js
More file actions
45 lines (42 loc) · 1.29 KB
/
dropShadow.js
File metadata and controls
45 lines (42 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import _ from 'lodash'
import nameClass from '../util/nameClass'
import { baseRules } from './filter'
export default function () {
return function ({ config, matchUtilities, addUtilities, theme, variants }) {
if (config('mode') === 'jit') {
matchUtilities(
{
'drop-shadow': (value, { includeBase }) => {
includeBase(baseRules)
return {
'--tw-drop-shadow': Array.isArray(value)
? value.map((v) => `drop-shadow(${v})`).join(' ')
: `drop-shadow(${value})`,
filter: 'var(--tw-filter)',
}
},
},
{
values: theme('dropShadow'),
variants: variants('dropShadow'),
type: 'lookup',
}
)
} else {
const utilities = _.fromPairs(
_.map(theme('dropShadow'), (value, modifier) => {
return [
nameClass('drop-shadow', modifier),
{
'--tw-drop-shadow': Array.isArray(value)
? value.map((v) => `drop-shadow(${v})`).join(' ')
: `drop-shadow(${value})`,
...(config('mode') === 'jit' ? { filter: 'var(--tw-filter)' } : {}),
},
]
})
)
addUtilities(utilities, variants('dropShadow'))
}
}
}