mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* prefix custom properties with tw- * prefix custom properties with tw- in tests * prefix gradient values in the defaultConfig * inline gradient-via-color * simplify --tw-tailwind-empty to --tw-empty * replace the long --tw-font-variant-numeric-... to the way shorter --tw-fvn-... * Rename --tw-box-shadow to --tw-shadow To match class name. * Rename font-variant-numeric variables * Remove 'transform' from transform variables * Shorten gradient variables * Fix style Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
import _ from 'lodash'
|
|
import nameClass from '../util/nameClass'
|
|
|
|
export default function () {
|
|
return function ({ addUtilities, theme, variants }) {
|
|
const generators = [
|
|
(_size, modifier) => {
|
|
const size = _size === '0' ? '0px' : _size
|
|
return {
|
|
[`${nameClass('space-y', modifier)} > :not([hidden]) ~ :not([hidden])`]: {
|
|
'--tw-space-y-reverse': '0',
|
|
'margin-top': `calc(${size} * calc(1 - var(--tw-space-y-reverse)))`,
|
|
'margin-bottom': `calc(${size} * var(--tw-space-y-reverse))`,
|
|
},
|
|
[`${nameClass('space-x', modifier)} > :not([hidden]) ~ :not([hidden])`]: {
|
|
'--tw-space-x-reverse': '0',
|
|
'margin-right': `calc(${size} * var(--tw-space-x-reverse))`,
|
|
'margin-left': `calc(${size} * calc(1 - var(--tw-space-x-reverse)))`,
|
|
},
|
|
}
|
|
},
|
|
]
|
|
|
|
const utilities = _.flatMap(generators, (generator) => {
|
|
return [
|
|
..._.flatMap(theme('space'), generator),
|
|
{
|
|
'.space-y-reverse > :not([hidden]) ~ :not([hidden])': {
|
|
'--tw-space-y-reverse': '1',
|
|
},
|
|
'.space-x-reverse > :not([hidden]) ~ :not([hidden])': {
|
|
'--tw-space-x-reverse': '1',
|
|
},
|
|
},
|
|
]
|
|
})
|
|
|
|
addUtilities(utilities, variants('space'))
|
|
}
|
|
}
|