/** * line-height 规则 */ import { UNIT_STR, NONNEGATIVE_NUMBER_REGEX_STR } from '../constant' export default { regExp: new RegExp(`^(lh|line-height)-(?((?${NONNEGATIVE_NUMBER_REGEX_STR})(?${UNIT_STR})?)|normal|unset|inherit|initial)$`), render ({ groups }) { const { value, num = Infinity, unit } = groups const base = { name: 'lineHeight'} if (num !== Infinity) { return { ...base, num, css: [`line-height: ${num}${unit}`] } } return { ...base, num, css: [`line-height: ${value}`] } } }