forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinset.js
39 lines (36 loc) · 1.26 KB
/
inset.js
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
import _ from 'lodash'
import prefixNegativeModifiers from '../util/prefixNegativeModifiers'
export default function() {
return function({ addUtilities, e, theme, variants }) {
const generators = [
(size, modifier) => ({
[`.${e(prefixNegativeModifiers('inset', modifier))}`]: {
top: `${size}`,
right: `${size}`,
bottom: `${size}`,
left: `${size}`,
},
}),
(size, modifier) => ({
[`.${e(prefixNegativeModifiers('inset-y', modifier))}`]: {
top: `${size}`,
bottom: `${size}`,
},
[`.${e(prefixNegativeModifiers('inset-x', modifier))}`]: {
right: `${size}`,
left: `${size}`,
},
}),
(size, modifier) => ({
[`.${e(prefixNegativeModifiers('top', modifier))}`]: { top: `${size}` },
[`.${e(prefixNegativeModifiers('right', modifier))}`]: { right: `${size}` },
[`.${e(prefixNegativeModifiers('bottom', modifier))}`]: { bottom: `${size}` },
[`.${e(prefixNegativeModifiers('left', modifier))}`]: { left: `${size}` },
}),
]
const utilities = _.flatMap(generators, generator => {
return _.flatMap(theme('inset'), generator)
})
addUtilities(utilities, variants('inset'))
}
}