forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdivideWidth.js
More file actions
47 lines (44 loc) · 1.36 KB
/
divideWidth.js
File metadata and controls
47 lines (44 loc) · 1.36 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
46
47
export default function () {
return function ({ matchUtilities, addUtilities, theme, variants }) {
matchUtilities(
{
'divide-x': (value) => {
value = value === '0' ? '0px' : value
return {
'& > :not([hidden]) ~ :not([hidden])': {
'--tw-divide-x-reverse': '0',
'border-right-width': `calc(${value} * var(--tw-divide-x-reverse))`,
'border-left-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
},
}
},
'divide-y': (value) => {
value = value === '0' ? '0px' : value
return {
'& > :not([hidden]) ~ :not([hidden])': {
'--tw-divide-y-reverse': '0',
'border-top-width': `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`,
'border-bottom-width': `calc(${value} * var(--tw-divide-y-reverse))`,
},
}
},
},
{
values: theme('divideWidth'),
variants: variants('divideWidth'),
type: 'length',
}
)
addUtilities(
{
'.divide-y-reverse > :not([hidden]) ~ :not([hidden])': {
'--tw-divide-y-reverse': '1',
},
'.divide-x-reverse > :not([hidden]) ~ :not([hidden])': {
'--tw-divide-x-reverse': '1',
},
},
variants('divideWidth')
)
}
}