2021-04-30 16:58:40 +02:00
|
|
|
import isPlainObject from '../util/isPlainObject'
|
2019-01-09 13:10:30 -05:00
|
|
|
|
2020-10-16 13:30:06 -04:00
|
|
|
export default function () {
|
2021-05-05 15:23:32 +02:00
|
|
|
return function ({ matchUtilities, theme, variants }) {
|
|
|
|
|
matchUtilities(
|
|
|
|
|
{
|
|
|
|
|
text: (value) => {
|
2021-04-30 16:58:40 +02:00
|
|
|
let [fontSize, options] = Array.isArray(value) ? value : [value]
|
|
|
|
|
let { lineHeight, letterSpacing } = isPlainObject(options)
|
|
|
|
|
? options
|
2021-05-05 15:23:32 +02:00
|
|
|
: { lineHeight: options }
|
2021-04-30 16:58:40 +02:00
|
|
|
|
|
|
|
|
return {
|
2021-05-05 15:23:32 +02:00
|
|
|
'font-size': fontSize,
|
|
|
|
|
...(lineHeight === undefined ? {} : { 'line-height': lineHeight }),
|
|
|
|
|
...(letterSpacing === undefined ? {} : { 'letter-spacing': letterSpacing }),
|
2021-04-30 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
},
|
2021-05-05 15:23:32 +02:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
values: theme('fontSize'),
|
|
|
|
|
variants: variants('fontSize'),
|
|
|
|
|
type: 'length',
|
|
|
|
|
}
|
|
|
|
|
)
|
2019-01-09 13:10:30 -05:00
|
|
|
}
|
|
|
|
|
}
|