frontend/.pnpm-store/v3/files/9f/55db2c94cb29ca3040193cfb912c15f28d8100b07f72c4828de41237f96965bd393963f648a75319939f6bc025212556b432ab3000b0dc1e29722fb736d5bb

64 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let Declaration = require('../declaration')
class BreakProps extends Declaration {
/**
* Change name for -webkit- and -moz- prefix
*/
prefixed (prop, prefix) {
return `${prefix}column-${prop}`
}
/**
* Return property name by final spec
*/
normalize (prop) {
if (prop.includes('inside')) {
return 'break-inside'
}
if (prop.includes('before')) {
return 'break-before'
}
return 'break-after'
}
/**
* Change prefixed value for avoid-column and avoid-page
*/
set (decl, prefix) {
if (
(decl.prop === 'break-inside' && decl.value === 'avoid-column') ||
decl.value === 'avoid-page'
) {
decl.value = 'avoid'
}
return super.set(decl, prefix)
}
/**
* Dont prefix some values
*/
insert (decl, prefix, prefixes) {
if (decl.prop !== 'break-inside') {
return super.insert(decl, prefix, prefixes)
}
if (/region/i.test(decl.value) || /page/i.test(decl.value)) {
return undefined
}
return super.insert(decl, prefix, prefixes)
}
}
BreakProps.names = [
'break-inside',
'page-break-inside',
'column-break-inside',
'break-before',
'page-break-before',
'column-break-before',
'break-after',
'page-break-after',
'column-break-after'
]
module.exports = BreakProps