autoprefixer 10.2.3 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/data/prefixes.js +206 -91
- package/lib/at-rule.js +2 -2
- package/lib/autoprefixer.d.ts +3 -3
- package/lib/autoprefixer.js +28 -18
- package/lib/brackets.js +3 -3
- package/lib/browsers.js +6 -6
- package/lib/declaration.js +14 -14
- package/lib/hacks/align-content.js +3 -3
- package/lib/hacks/align-items.js +3 -3
- package/lib/hacks/align-self.js +4 -4
- package/lib/hacks/animation.js +1 -1
- package/lib/hacks/appearance.js +1 -1
- package/lib/hacks/backdrop-filter.js +1 -1
- package/lib/hacks/background-clip.js +2 -2
- package/lib/hacks/background-size.js +1 -1
- package/lib/hacks/block-logical.js +2 -2
- package/lib/hacks/border-image.js +1 -1
- package/lib/hacks/border-radius.js +2 -2
- package/lib/hacks/break-props.js +4 -4
- package/lib/hacks/color-adjust.js +2 -2
- package/lib/hacks/cross-fade.js +1 -1
- package/lib/hacks/display-flex.js +5 -5
- package/lib/hacks/display-grid.js +2 -2
- package/lib/hacks/file-selector-button.js +17 -0
- package/lib/hacks/filter-value.js +1 -1
- package/lib/hacks/filter.js +1 -1
- package/lib/hacks/flex-basis.js +3 -3
- package/lib/hacks/flex-direction.js +3 -3
- package/lib/hacks/flex-flow.js +1 -1
- package/lib/hacks/flex-grow.js +2 -2
- package/lib/hacks/flex-shrink.js +3 -3
- package/lib/hacks/flex-wrap.js +1 -1
- package/lib/hacks/flex.js +3 -3
- package/lib/hacks/fullscreen.js +1 -1
- package/lib/hacks/gradient.js +18 -18
- package/lib/hacks/grid-area.js +1 -1
- package/lib/hacks/grid-column-align.js +3 -3
- package/lib/hacks/grid-end.js +1 -1
- package/lib/hacks/grid-row-align.js +3 -3
- package/lib/hacks/grid-row-column.js +1 -1
- package/lib/hacks/grid-rows-columns.js +3 -3
- package/lib/hacks/grid-start.js +3 -3
- package/lib/hacks/grid-template-areas.js +2 -2
- package/lib/hacks/grid-template.js +1 -1
- package/lib/hacks/grid-utils.js +60 -48
- package/lib/hacks/image-rendering.js +5 -5
- package/lib/hacks/image-set.js +1 -1
- package/lib/hacks/inline-logical.js +2 -2
- package/lib/hacks/intrinsic.js +6 -6
- package/lib/hacks/justify-content.js +3 -3
- package/lib/hacks/mask-border.js +2 -2
- package/lib/hacks/mask-composite.js +1 -1
- package/lib/hacks/order.js +3 -3
- package/lib/hacks/overscroll-behavior.js +3 -3
- package/lib/hacks/pixelated.js +2 -2
- package/lib/hacks/place-self.js +1 -1
- package/lib/hacks/placeholder-shown.js +1 -1
- package/lib/hacks/placeholder.js +2 -2
- package/lib/hacks/text-decoration-skip-ink.js +1 -1
- package/lib/hacks/text-decoration.js +1 -1
- package/lib/hacks/text-emphasis-position.js +1 -1
- package/lib/hacks/transform-decl.js +4 -4
- package/lib/hacks/user-select.js +2 -2
- package/lib/hacks/writing-mode.js +1 -1
- package/lib/info.js +8 -4
- package/lib/old-selector.js +3 -3
- package/lib/old-value.js +2 -2
- package/lib/prefixer.js +13 -11
- package/lib/prefixes.js +126 -68
- package/lib/processor.js +14 -14
- package/lib/resolution.js +6 -6
- package/lib/selector.js +10 -10
- package/lib/supports.js +28 -20
- package/lib/transition.js +15 -15
- package/lib/utils.js +65 -67
- package/lib/value.js +7 -7
- package/lib/vendor.js +2 -2
- package/package.json +5 -5
- package/CHANGELOG.md +0 -1022
package/lib/info.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
let browserslist = require('browserslist')
|
|
2
2
|
|
|
3
|
-
function capitalize
|
|
3
|
+
function capitalize(str) {
|
|
4
4
|
return str.slice(0, 1).toUpperCase() + str.slice(1)
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
const NAMES = {
|
|
8
8
|
ie: 'IE',
|
|
9
9
|
ie_mob: 'IE Mobile',
|
|
10
|
-
ios_saf: 'iOS',
|
|
10
|
+
ios_saf: 'iOS Safari',
|
|
11
11
|
op_mini: 'Opera Mini',
|
|
12
12
|
op_mob: 'Opera Mobile',
|
|
13
13
|
and_chr: 'Chrome for Android',
|
|
14
14
|
and_ff: 'Firefox for Android',
|
|
15
|
-
and_uc: 'UC for Android'
|
|
15
|
+
and_uc: 'UC for Android',
|
|
16
|
+
and_qq: 'QQ Browser',
|
|
17
|
+
kaios: 'KaiOS Browser',
|
|
18
|
+
baidu: 'Baidu Browser',
|
|
19
|
+
samsung: 'Samsung Internet'
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
function prefix
|
|
22
|
+
function prefix(name, prefixes, note) {
|
|
19
23
|
let out = ` ${name}`
|
|
20
24
|
if (note) out += ' *'
|
|
21
25
|
out += ': '
|
package/lib/old-selector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
class OldSelector {
|
|
2
|
-
constructor
|
|
2
|
+
constructor(selector, prefix) {
|
|
3
3
|
this.prefix = prefix
|
|
4
4
|
this.prefixed = selector.prefixed(this.prefix)
|
|
5
5
|
this.regexp = selector.regexp(this.prefix)
|
|
@@ -15,7 +15,7 @@ class OldSelector {
|
|
|
15
15
|
/**
|
|
16
16
|
* Is rule a hack without unprefixed version bottom
|
|
17
17
|
*/
|
|
18
|
-
isHack
|
|
18
|
+
isHack(rule) {
|
|
19
19
|
let index = rule.parent.index(rule) + 1
|
|
20
20
|
let rules = rule.parent.nodes
|
|
21
21
|
|
|
@@ -50,7 +50,7 @@ class OldSelector {
|
|
|
50
50
|
/**
|
|
51
51
|
* Does rule contain an unnecessary prefixed selector
|
|
52
52
|
*/
|
|
53
|
-
check
|
|
53
|
+
check(rule) {
|
|
54
54
|
if (!rule.selector.includes(this.prefixed)) {
|
|
55
55
|
return false
|
|
56
56
|
}
|
package/lib/old-value.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
let utils = require('./utils')
|
|
2
2
|
|
|
3
3
|
class OldValue {
|
|
4
|
-
constructor
|
|
4
|
+
constructor(unprefixed, prefixed, string, regexp) {
|
|
5
5
|
this.unprefixed = unprefixed
|
|
6
6
|
this.prefixed = prefixed
|
|
7
7
|
this.string = string || prefixed
|
|
@@ -11,7 +11,7 @@ class OldValue {
|
|
|
11
11
|
/**
|
|
12
12
|
* Check, that value contain old value
|
|
13
13
|
*/
|
|
14
|
-
check
|
|
14
|
+
check(value) {
|
|
15
15
|
if (value.includes(this.string)) {
|
|
16
16
|
return !!value.match(this.regexp)
|
|
17
17
|
}
|
package/lib/prefixer.js
CHANGED
|
@@ -5,7 +5,7 @@ let utils = require('./utils')
|
|
|
5
5
|
/**
|
|
6
6
|
* Recursively clone objects
|
|
7
7
|
*/
|
|
8
|
-
function clone
|
|
8
|
+
function clone(obj, parent) {
|
|
9
9
|
let cloned = new obj.constructor()
|
|
10
10
|
|
|
11
11
|
for (let i of Object.keys(obj || {})) {
|
|
@@ -16,11 +16,13 @@ function clone (obj, parent) {
|
|
|
16
16
|
}
|
|
17
17
|
} else if (i === 'source' || i === null) {
|
|
18
18
|
cloned[i] = value
|
|
19
|
-
} else if (i === 'proxyCache') {
|
|
20
|
-
continue
|
|
21
19
|
} else if (Array.isArray(value)) {
|
|
22
20
|
cloned[i] = value.map(x => clone(x, cloned))
|
|
23
|
-
} else if (
|
|
21
|
+
} else if (
|
|
22
|
+
i !== '_autoprefixerPrefix' &&
|
|
23
|
+
i !== '_autoprefixerValues' &&
|
|
24
|
+
i !== 'proxyCache'
|
|
25
|
+
) {
|
|
24
26
|
if (typeof value === 'object' && value !== null) {
|
|
25
27
|
value = clone(value, cloned)
|
|
26
28
|
}
|
|
@@ -35,7 +37,7 @@ class Prefixer {
|
|
|
35
37
|
/**
|
|
36
38
|
* Add hack to selected names
|
|
37
39
|
*/
|
|
38
|
-
static hack
|
|
40
|
+
static hack(klass) {
|
|
39
41
|
if (!this.hacks) {
|
|
40
42
|
this.hacks = {}
|
|
41
43
|
}
|
|
@@ -48,7 +50,7 @@ class Prefixer {
|
|
|
48
50
|
/**
|
|
49
51
|
* Load hacks for some names
|
|
50
52
|
*/
|
|
51
|
-
static load
|
|
53
|
+
static load(name, prefixes, all) {
|
|
52
54
|
let Klass = this.hacks && this.hacks[name]
|
|
53
55
|
if (Klass) {
|
|
54
56
|
return new Klass(name, prefixes, all)
|
|
@@ -60,7 +62,7 @@ class Prefixer {
|
|
|
60
62
|
/**
|
|
61
63
|
* Clone node and clean autprefixer custom caches
|
|
62
64
|
*/
|
|
63
|
-
static clone
|
|
65
|
+
static clone(node, overrides) {
|
|
64
66
|
let cloned = clone(node)
|
|
65
67
|
for (let name in overrides) {
|
|
66
68
|
cloned[name] = overrides[name]
|
|
@@ -68,7 +70,7 @@ class Prefixer {
|
|
|
68
70
|
return cloned
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
constructor
|
|
73
|
+
constructor(name, prefixes, all) {
|
|
72
74
|
this.prefixes = prefixes
|
|
73
75
|
this.name = name
|
|
74
76
|
this.all = all
|
|
@@ -77,7 +79,7 @@ class Prefixer {
|
|
|
77
79
|
/**
|
|
78
80
|
* Find prefix in node parents
|
|
79
81
|
*/
|
|
80
|
-
parentPrefix
|
|
82
|
+
parentPrefix(node) {
|
|
81
83
|
let prefix
|
|
82
84
|
|
|
83
85
|
if (typeof node._autoprefixerPrefix !== 'undefined') {
|
|
@@ -110,7 +112,7 @@ class Prefixer {
|
|
|
110
112
|
/**
|
|
111
113
|
* Clone node with prefixes
|
|
112
114
|
*/
|
|
113
|
-
process
|
|
115
|
+
process(node, result) {
|
|
114
116
|
if (!this.check(node)) {
|
|
115
117
|
return undefined
|
|
116
118
|
}
|
|
@@ -134,7 +136,7 @@ class Prefixer {
|
|
|
134
136
|
/**
|
|
135
137
|
* Shortcut for Prefixer.clone
|
|
136
138
|
*/
|
|
137
|
-
clone
|
|
139
|
+
clone(node, overrides) {
|
|
138
140
|
return Prefixer.clone(node, overrides)
|
|
139
141
|
}
|
|
140
142
|
}
|
package/lib/prefixes.js
CHANGED
|
@@ -9,66 +9,124 @@ let Selector = require('./selector')
|
|
|
9
9
|
let AtRule = require('./at-rule')
|
|
10
10
|
let Value = require('./value')
|
|
11
11
|
let utils = require('./utils')
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
12
|
+
let hackFullscreen = require('./hacks/fullscreen')
|
|
13
|
+
let hackPlaceholder = require('./hacks/placeholder')
|
|
14
|
+
let hackPlaceholderShown = require('./hacks/placeholder-shown')
|
|
15
|
+
let hackFileSelectorButton = require('./hacks/file-selector-button')
|
|
16
|
+
let hackFlex = require('./hacks/flex')
|
|
17
|
+
let hackOrder = require('./hacks/order')
|
|
18
|
+
let hackFilter = require('./hacks/filter')
|
|
19
|
+
let hackGridEnd = require('./hacks/grid-end')
|
|
20
|
+
let hackAnimation = require('./hacks/animation')
|
|
21
|
+
let hackFlexFlow = require('./hacks/flex-flow')
|
|
22
|
+
let hackFlexGrow = require('./hacks/flex-grow')
|
|
23
|
+
let hackFlexWrap = require('./hacks/flex-wrap')
|
|
24
|
+
let hackGridArea = require('./hacks/grid-area')
|
|
25
|
+
let hackPlaceSelf = require('./hacks/place-self')
|
|
26
|
+
let hackGridStart = require('./hacks/grid-start')
|
|
27
|
+
let hackAlignSelf = require('./hacks/align-self')
|
|
28
|
+
let hackAppearance = require('./hacks/appearance')
|
|
29
|
+
let hackFlexBasis = require('./hacks/flex-basis')
|
|
30
|
+
let hackMaskBorder = require('./hacks/mask-border')
|
|
31
|
+
let hackMaskComposite = require('./hacks/mask-composite')
|
|
32
|
+
let hackAlignItems = require('./hacks/align-items')
|
|
33
|
+
let hackUserSelect = require('./hacks/user-select')
|
|
34
|
+
let hackFlexShrink = require('./hacks/flex-shrink')
|
|
35
|
+
let hackBreakProps = require('./hacks/break-props')
|
|
36
|
+
let hackColorAdjust = require('./hacks/color-adjust')
|
|
37
|
+
let hackWritingMode = require('./hacks/writing-mode')
|
|
38
|
+
let hackBorderImage = require('./hacks/border-image')
|
|
39
|
+
let hackAlignContent = require('./hacks/align-content')
|
|
40
|
+
let hackBorderRadius = require('./hacks/border-radius')
|
|
41
|
+
let hackBlockLogical = require('./hacks/block-logical')
|
|
42
|
+
let hackGridTemplate = require('./hacks/grid-template')
|
|
43
|
+
let hackInlineLogical = require('./hacks/inline-logical')
|
|
44
|
+
let hackGridRowAlign = require('./hacks/grid-row-align')
|
|
45
|
+
let hackTransformDecl = require('./hacks/transform-decl')
|
|
46
|
+
let hackFlexDirection = require('./hacks/flex-direction')
|
|
47
|
+
let hackImageRendering = require('./hacks/image-rendering')
|
|
48
|
+
let hackBackdropFilter = require('./hacks/backdrop-filter')
|
|
49
|
+
let hackBackgroundClip = require('./hacks/background-clip')
|
|
50
|
+
let hackTextDecoration = require('./hacks/text-decoration')
|
|
51
|
+
let hackJustifyContent = require('./hacks/justify-content')
|
|
52
|
+
let hackBackgroundSize = require('./hacks/background-size')
|
|
53
|
+
let hackGridRowColumn = require('./hacks/grid-row-column')
|
|
54
|
+
let hackGridRowsColumns = require('./hacks/grid-rows-columns')
|
|
55
|
+
let hackGridColumnAlign = require('./hacks/grid-column-align')
|
|
56
|
+
let hackOverscrollBehavior = require('./hacks/overscroll-behavior')
|
|
57
|
+
let hackGridTemplateAreas = require('./hacks/grid-template-areas')
|
|
58
|
+
let hackTextEmphasisPosition = require('./hacks/text-emphasis-position')
|
|
59
|
+
let hackTextDecorationSkipInk = require('./hacks/text-decoration-skip-ink')
|
|
60
|
+
let hackGradient = require('./hacks/gradient')
|
|
61
|
+
let hackIntrinsic = require('./hacks/intrinsic')
|
|
62
|
+
let hackPixelated = require('./hacks/pixelated')
|
|
63
|
+
let hackImageSet = require('./hacks/image-set')
|
|
64
|
+
let hackCrossFade = require('./hacks/cross-fade')
|
|
65
|
+
let hackDisplayFlex = require('./hacks/display-flex')
|
|
66
|
+
let hackDisplayGrid = require('./hacks/display-grid')
|
|
67
|
+
let hackFilterValue = require('./hacks/filter-value')
|
|
68
|
+
|
|
69
|
+
Selector.hack(hackFullscreen)
|
|
70
|
+
Selector.hack(hackPlaceholder)
|
|
71
|
+
Selector.hack(hackPlaceholderShown)
|
|
72
|
+
Selector.hack(hackFileSelectorButton)
|
|
73
|
+
Declaration.hack(hackFlex)
|
|
74
|
+
Declaration.hack(hackOrder)
|
|
75
|
+
Declaration.hack(hackFilter)
|
|
76
|
+
Declaration.hack(hackGridEnd)
|
|
77
|
+
Declaration.hack(hackAnimation)
|
|
78
|
+
Declaration.hack(hackFlexFlow)
|
|
79
|
+
Declaration.hack(hackFlexGrow)
|
|
80
|
+
Declaration.hack(hackFlexWrap)
|
|
81
|
+
Declaration.hack(hackGridArea)
|
|
82
|
+
Declaration.hack(hackPlaceSelf)
|
|
83
|
+
Declaration.hack(hackGridStart)
|
|
84
|
+
Declaration.hack(hackAlignSelf)
|
|
85
|
+
Declaration.hack(hackAppearance)
|
|
86
|
+
Declaration.hack(hackFlexBasis)
|
|
87
|
+
Declaration.hack(hackMaskBorder)
|
|
88
|
+
Declaration.hack(hackMaskComposite)
|
|
89
|
+
Declaration.hack(hackAlignItems)
|
|
90
|
+
Declaration.hack(hackUserSelect)
|
|
91
|
+
Declaration.hack(hackFlexShrink)
|
|
92
|
+
Declaration.hack(hackBreakProps)
|
|
93
|
+
Declaration.hack(hackColorAdjust)
|
|
94
|
+
Declaration.hack(hackWritingMode)
|
|
95
|
+
Declaration.hack(hackBorderImage)
|
|
96
|
+
Declaration.hack(hackAlignContent)
|
|
97
|
+
Declaration.hack(hackBorderRadius)
|
|
98
|
+
Declaration.hack(hackBlockLogical)
|
|
99
|
+
Declaration.hack(hackGridTemplate)
|
|
100
|
+
Declaration.hack(hackInlineLogical)
|
|
101
|
+
Declaration.hack(hackGridRowAlign)
|
|
102
|
+
Declaration.hack(hackTransformDecl)
|
|
103
|
+
Declaration.hack(hackFlexDirection)
|
|
104
|
+
Declaration.hack(hackImageRendering)
|
|
105
|
+
Declaration.hack(hackBackdropFilter)
|
|
106
|
+
Declaration.hack(hackBackgroundClip)
|
|
107
|
+
Declaration.hack(hackTextDecoration)
|
|
108
|
+
Declaration.hack(hackJustifyContent)
|
|
109
|
+
Declaration.hack(hackBackgroundSize)
|
|
110
|
+
Declaration.hack(hackGridRowColumn)
|
|
111
|
+
Declaration.hack(hackGridRowsColumns)
|
|
112
|
+
Declaration.hack(hackGridColumnAlign)
|
|
113
|
+
Declaration.hack(hackOverscrollBehavior)
|
|
114
|
+
Declaration.hack(hackGridTemplateAreas)
|
|
115
|
+
Declaration.hack(hackTextEmphasisPosition)
|
|
116
|
+
Declaration.hack(hackTextDecorationSkipInk)
|
|
117
|
+
Value.hack(hackGradient)
|
|
118
|
+
Value.hack(hackIntrinsic)
|
|
119
|
+
Value.hack(hackPixelated)
|
|
120
|
+
Value.hack(hackImageSet)
|
|
121
|
+
Value.hack(hackCrossFade)
|
|
122
|
+
Value.hack(hackDisplayFlex)
|
|
123
|
+
Value.hack(hackDisplayGrid)
|
|
124
|
+
Value.hack(hackFilterValue)
|
|
67
125
|
|
|
68
126
|
let declsCache = new Map()
|
|
69
127
|
|
|
70
128
|
class Prefixes {
|
|
71
|
-
constructor
|
|
129
|
+
constructor(data, browsers, options = {}) {
|
|
72
130
|
this.data = data
|
|
73
131
|
this.browsers = browsers
|
|
74
132
|
this.options = options
|
|
@@ -80,7 +138,7 @@ class Prefixes {
|
|
|
80
138
|
/**
|
|
81
139
|
* Return clone instance to remove all prefixes
|
|
82
140
|
*/
|
|
83
|
-
cleaner
|
|
141
|
+
cleaner() {
|
|
84
142
|
if (this.cleanerCache) {
|
|
85
143
|
return this.cleanerCache
|
|
86
144
|
}
|
|
@@ -98,7 +156,7 @@ class Prefixes {
|
|
|
98
156
|
/**
|
|
99
157
|
* Select prefixes from data, which is necessary for selected browsers
|
|
100
158
|
*/
|
|
101
|
-
select
|
|
159
|
+
select(list) {
|
|
102
160
|
let selected = { add: {}, remove: {} }
|
|
103
161
|
|
|
104
162
|
for (let name in list) {
|
|
@@ -155,7 +213,7 @@ class Prefixes {
|
|
|
155
213
|
/**
|
|
156
214
|
* Sort vendor prefixes
|
|
157
215
|
*/
|
|
158
|
-
sort
|
|
216
|
+
sort(prefixes) {
|
|
159
217
|
return prefixes.sort((a, b) => {
|
|
160
218
|
let aLength = utils.removeNote(a).length
|
|
161
219
|
let bLength = utils.removeNote(b).length
|
|
@@ -171,7 +229,7 @@ class Prefixes {
|
|
|
171
229
|
/**
|
|
172
230
|
* Cache prefixes data to fast CSS processing
|
|
173
231
|
*/
|
|
174
|
-
preprocess
|
|
232
|
+
preprocess(selected) {
|
|
175
233
|
let add = {
|
|
176
234
|
'selectors': [],
|
|
177
235
|
'@supports': new Supports(Prefixes, this)
|
|
@@ -266,7 +324,7 @@ class Prefixes {
|
|
|
266
324
|
/**
|
|
267
325
|
* Declaration loader with caching
|
|
268
326
|
*/
|
|
269
|
-
decl
|
|
327
|
+
decl(prop) {
|
|
270
328
|
if (!declsCache.has(prop)) {
|
|
271
329
|
declsCache.set(prop, Declaration.load(prop))
|
|
272
330
|
}
|
|
@@ -277,7 +335,7 @@ class Prefixes {
|
|
|
277
335
|
/**
|
|
278
336
|
* Return unprefixed version of property
|
|
279
337
|
*/
|
|
280
|
-
unprefixed
|
|
338
|
+
unprefixed(prop) {
|
|
281
339
|
let value = this.normalize(vendor.unprefixed(prop))
|
|
282
340
|
if (value === 'flex-direction') {
|
|
283
341
|
value = 'flex-flow'
|
|
@@ -288,14 +346,14 @@ class Prefixes {
|
|
|
288
346
|
/**
|
|
289
347
|
* Normalize prefix for remover
|
|
290
348
|
*/
|
|
291
|
-
normalize
|
|
349
|
+
normalize(prop) {
|
|
292
350
|
return this.decl(prop).normalize(prop)
|
|
293
351
|
}
|
|
294
352
|
|
|
295
353
|
/**
|
|
296
354
|
* Return prefixed version of property
|
|
297
355
|
*/
|
|
298
|
-
prefixed
|
|
356
|
+
prefixed(prop, prefix) {
|
|
299
357
|
prop = vendor.unprefixed(prop)
|
|
300
358
|
return this.decl(prop).prefixed(prop, prefix)
|
|
301
359
|
}
|
|
@@ -303,7 +361,7 @@ class Prefixes {
|
|
|
303
361
|
/**
|
|
304
362
|
* Return values, which must be prefixed in selected property
|
|
305
363
|
*/
|
|
306
|
-
values
|
|
364
|
+
values(type, prop) {
|
|
307
365
|
let data = this[type]
|
|
308
366
|
|
|
309
367
|
let global = data['*'] && data['*'].values
|
|
@@ -319,7 +377,7 @@ class Prefixes {
|
|
|
319
377
|
/**
|
|
320
378
|
* Group declaration by unprefixed property to check them
|
|
321
379
|
*/
|
|
322
|
-
group
|
|
380
|
+
group(decl) {
|
|
323
381
|
let rule = decl.parent
|
|
324
382
|
let index = rule.index(decl)
|
|
325
383
|
let { length } = rule.nodes
|
|
@@ -355,10 +413,10 @@ class Prefixes {
|
|
|
355
413
|
}
|
|
356
414
|
|
|
357
415
|
return {
|
|
358
|
-
up
|
|
416
|
+
up(callback) {
|
|
359
417
|
return checker(-1, callback)
|
|
360
418
|
},
|
|
361
|
-
down
|
|
419
|
+
down(callback) {
|
|
362
420
|
return checker(+1, callback)
|
|
363
421
|
}
|
|
364
422
|
}
|
package/lib/processor.js
CHANGED
|
@@ -23,27 +23,27 @@ const SIZES = [
|
|
|
23
23
|
'max-block-size'
|
|
24
24
|
]
|
|
25
25
|
|
|
26
|
-
function hasGridTemplate
|
|
26
|
+
function hasGridTemplate(decl) {
|
|
27
27
|
return decl.parent.some(
|
|
28
28
|
i => i.prop === 'grid-template' || i.prop === 'grid-template-areas'
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function hasRowsAndColumns
|
|
32
|
+
function hasRowsAndColumns(decl) {
|
|
33
33
|
let hasRows = decl.parent.some(i => i.prop === 'grid-template-rows')
|
|
34
34
|
let hasColumns = decl.parent.some(i => i.prop === 'grid-template-columns')
|
|
35
35
|
return hasRows && hasColumns
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
class Processor {
|
|
39
|
-
constructor
|
|
39
|
+
constructor(prefixes) {
|
|
40
40
|
this.prefixes = prefixes
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Add necessary prefixes
|
|
45
45
|
*/
|
|
46
|
-
add
|
|
46
|
+
add(css, result) {
|
|
47
47
|
// At-rules
|
|
48
48
|
let resolution = this.prefixes.add['@resolution']
|
|
49
49
|
let keyframes = this.prefixes.add['@keyframes']
|
|
@@ -84,7 +84,7 @@ class Processor {
|
|
|
84
84
|
})
|
|
85
85
|
})
|
|
86
86
|
|
|
87
|
-
function insideGrid
|
|
87
|
+
function insideGrid(decl) {
|
|
88
88
|
return decl.parent.nodes.some(node => {
|
|
89
89
|
if (node.type !== 'decl') return false
|
|
90
90
|
let displayGrid =
|
|
@@ -94,7 +94,7 @@ class Processor {
|
|
|
94
94
|
return displayGrid || gridTemplate || gridGap
|
|
95
95
|
})
|
|
96
96
|
}
|
|
97
|
-
function insideFlex
|
|
97
|
+
function insideFlex(decl) {
|
|
98
98
|
return decl.parent.some(node => {
|
|
99
99
|
return node.prop === 'display' && /(inline-)?flex/.test(node.value)
|
|
100
100
|
})
|
|
@@ -391,7 +391,7 @@ class Processor {
|
|
|
391
391
|
/**
|
|
392
392
|
* Remove unnecessary pefixes
|
|
393
393
|
*/
|
|
394
|
-
remove
|
|
394
|
+
remove(css, result) {
|
|
395
395
|
// At-rules
|
|
396
396
|
let resolution = this.prefixes.remove['@resolution']
|
|
397
397
|
|
|
@@ -479,14 +479,14 @@ class Processor {
|
|
|
479
479
|
/**
|
|
480
480
|
* Some rare old values, which is not in standard
|
|
481
481
|
*/
|
|
482
|
-
withHackValue
|
|
482
|
+
withHackValue(decl) {
|
|
483
483
|
return decl.prop === '-webkit-background-clip' && decl.value === 'text'
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
/**
|
|
487
487
|
* Check for grid/flexbox options.
|
|
488
488
|
*/
|
|
489
|
-
disabledValue
|
|
489
|
+
disabledValue(node, result) {
|
|
490
490
|
if (this.gridStatus(node, result) === false && node.type === 'decl') {
|
|
491
491
|
if (node.prop === 'display' && node.value.includes('grid')) {
|
|
492
492
|
return true
|
|
@@ -504,7 +504,7 @@ class Processor {
|
|
|
504
504
|
/**
|
|
505
505
|
* Check for grid/flexbox options.
|
|
506
506
|
*/
|
|
507
|
-
disabledDecl
|
|
507
|
+
disabledDecl(node, result) {
|
|
508
508
|
if (this.gridStatus(node, result) === false && node.type === 'decl') {
|
|
509
509
|
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
|
510
510
|
return true
|
|
@@ -523,7 +523,7 @@ class Processor {
|
|
|
523
523
|
/**
|
|
524
524
|
* Check for control comment and global options
|
|
525
525
|
*/
|
|
526
|
-
disabled
|
|
526
|
+
disabled(node, result) {
|
|
527
527
|
if (!node) return false
|
|
528
528
|
|
|
529
529
|
if (node._autoprefixerDisabled !== undefined) {
|
|
@@ -581,7 +581,7 @@ class Processor {
|
|
|
581
581
|
/**
|
|
582
582
|
* Normalize spaces in cascade declaration group
|
|
583
583
|
*/
|
|
584
|
-
reduceSpaces
|
|
584
|
+
reduceSpaces(decl) {
|
|
585
585
|
let stop = false
|
|
586
586
|
this.prefixes.group(decl).up(() => {
|
|
587
587
|
stop = true
|
|
@@ -613,7 +613,7 @@ class Processor {
|
|
|
613
613
|
/**
|
|
614
614
|
* Is it flebox or grid rule
|
|
615
615
|
*/
|
|
616
|
-
displayType
|
|
616
|
+
displayType(decl) {
|
|
617
617
|
for (let i of decl.parent.nodes) {
|
|
618
618
|
if (i.prop !== 'display') {
|
|
619
619
|
continue
|
|
@@ -634,7 +634,7 @@ class Processor {
|
|
|
634
634
|
/**
|
|
635
635
|
* Set grid option via control comment
|
|
636
636
|
*/
|
|
637
|
-
gridStatus
|
|
637
|
+
gridStatus(node, result) {
|
|
638
638
|
if (!node) return false
|
|
639
639
|
|
|
640
640
|
if (node._autoprefixerGridStatus !== undefined) {
|
package/lib/resolution.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let
|
|
1
|
+
let FractionJs = require('fraction.js')
|
|
2
2
|
|
|
3
3
|
let Prefixer = require('./prefixer')
|
|
4
4
|
let utils = require('./utils')
|
|
@@ -10,7 +10,7 @@ class Resolution extends Prefixer {
|
|
|
10
10
|
/**
|
|
11
11
|
* Return prefixed query name
|
|
12
12
|
*/
|
|
13
|
-
prefixName
|
|
13
|
+
prefixName(prefix, name) {
|
|
14
14
|
if (prefix === '-moz-') {
|
|
15
15
|
return name + '--moz-device-pixel-ratio'
|
|
16
16
|
} else {
|
|
@@ -21,8 +21,8 @@ class Resolution extends Prefixer {
|
|
|
21
21
|
/**
|
|
22
22
|
* Return prefixed query
|
|
23
23
|
*/
|
|
24
|
-
prefixQuery
|
|
25
|
-
value = new
|
|
24
|
+
prefixQuery(prefix, name, colon, value, units) {
|
|
25
|
+
value = new FractionJs(value)
|
|
26
26
|
|
|
27
27
|
// 1dpcm = 2.54dpi
|
|
28
28
|
// 1dppx = 96dpi
|
|
@@ -42,7 +42,7 @@ class Resolution extends Prefixer {
|
|
|
42
42
|
/**
|
|
43
43
|
* Remove prefixed queries
|
|
44
44
|
*/
|
|
45
|
-
clean
|
|
45
|
+
clean(rule) {
|
|
46
46
|
if (!this.bad) {
|
|
47
47
|
this.bad = []
|
|
48
48
|
for (let prefix of this.prefixes) {
|
|
@@ -59,7 +59,7 @@ class Resolution extends Prefixer {
|
|
|
59
59
|
/**
|
|
60
60
|
* Add prefixed queries
|
|
61
61
|
*/
|
|
62
|
-
process
|
|
62
|
+
process(rule) {
|
|
63
63
|
let parent = this.parentPrefix(rule)
|
|
64
64
|
let prefixes = parent ? [parent] : this.prefixes
|
|
65
65
|
|