Debian Codegraph @

autoprefixer/lib/hacks/align-content.js

raw symbols SCIP
1 let Declaration = require('../declaration')
2 let flexSpec = require('./flex-spec')
3
4 class AlignContent extends Declaration {
5 /**
6 * Return property name by final spec
7 */
8 normalize() {
9 return 'align-content'
10 }
11
12 /**
13 * Change property name for 2012 spec
14 */
15 prefixed(prop, prefix) {
16 let spec
17 ;[spec, prefix] = flexSpec(prefix)
18 if (spec === 2012) {
19 return prefix + 'flex-line-pack'
20 }
21 return super.prefixed(prop, prefix)
22 }
23
24 /**
25 * Change value for 2012 spec and ignore prefix for 2009
26 */
27 set(decl, prefix) {
28 let spec = flexSpec(prefix)[0]
29 if (spec === 2012) {
30 decl.value = AlignContent.oldValues[decl.value] || decl.value
31 return super.set(decl, prefix)
32 }
33 if (spec === 'final') {
34 return super.set(decl, prefix)
35 }
36 return undefined
37 }
38 }
39
40 AlignContent.names = ['align-content', 'flex-line-pack']
41
42 AlignContent.oldValues = {
43 'flex-end': 'end',
44 'flex-start': 'start',
45 'space-around': 'distribute',
46 'space-between': 'justify'
47 }
48
49 module.exports = AlignContent