autoprefixer 10.2.4 → 10.3.1
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 +2 -2
- package/lib/old-selector.js +3 -3
- package/lib/old-value.js +2 -2
- package/lib/prefixer.js +8 -8
- package/lib/prefixes.js +126 -68
- package/lib/processor.js +17 -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 -1025
package/lib/info.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
|
@@ -19,7 +19,7 @@ const NAMES = {
|
|
|
19
19
|
samsung: 'Samsung Internet'
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
function prefix
|
|
22
|
+
function prefix(name, prefixes, note) {
|
|
23
23
|
let out = ` ${name}`
|
|
24
24
|
if (note) out += ' *'
|
|
25
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 || {})) {
|
|
@@ -37,7 +37,7 @@ class Prefixer {
|
|
|
37
37
|
/**
|
|
38
38
|
* Add hack to selected names
|
|
39
39
|
*/
|
|
40
|
-
static hack
|
|
40
|
+
static hack(klass) {
|
|
41
41
|
if (!this.hacks) {
|
|
42
42
|
this.hacks = {}
|
|
43
43
|
}
|
|
@@ -50,7 +50,7 @@ class Prefixer {
|
|
|
50
50
|
/**
|
|
51
51
|
* Load hacks for some names
|
|
52
52
|
*/
|
|
53
|
-
static load
|
|
53
|
+
static load(name, prefixes, all) {
|
|
54
54
|
let Klass = this.hacks && this.hacks[name]
|
|
55
55
|
if (Klass) {
|
|
56
56
|
return new Klass(name, prefixes, all)
|
|
@@ -62,7 +62,7 @@ class Prefixer {
|
|
|
62
62
|
/**
|
|
63
63
|
* Clone node and clean autprefixer custom caches
|
|
64
64
|
*/
|
|
65
|
-
static clone
|
|
65
|
+
static clone(node, overrides) {
|
|
66
66
|
let cloned = clone(node)
|
|
67
67
|
for (let name in overrides) {
|
|
68
68
|
cloned[name] = overrides[name]
|
|
@@ -70,7 +70,7 @@ class Prefixer {
|
|
|
70
70
|
return cloned
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
constructor
|
|
73
|
+
constructor(name, prefixes, all) {
|
|
74
74
|
this.prefixes = prefixes
|
|
75
75
|
this.name = name
|
|
76
76
|
this.all = all
|
|
@@ -79,7 +79,7 @@ class Prefixer {
|
|
|
79
79
|
/**
|
|
80
80
|
* Find prefix in node parents
|
|
81
81
|
*/
|
|
82
|
-
parentPrefix
|
|
82
|
+
parentPrefix(node) {
|
|
83
83
|
let prefix
|
|
84
84
|
|
|
85
85
|
if (typeof node._autoprefixerPrefix !== 'undefined') {
|
|
@@ -112,7 +112,7 @@ class Prefixer {
|
|
|
112
112
|
/**
|
|
113
113
|
* Clone node with prefixes
|
|
114
114
|
*/
|
|
115
|
-
process
|
|
115
|
+
process(node, result) {
|
|
116
116
|
if (!this.check(node)) {
|
|
117
117
|
return undefined
|
|
118
118
|
}
|
|
@@ -136,7 +136,7 @@ class Prefixer {
|
|
|
136
136
|
/**
|
|
137
137
|
* Shortcut for Prefixer.clone
|
|
138
138
|
*/
|
|
139
|
-
clone
|
|
139
|
+
clone(node, overrides) {
|
|
140
140
|
return Prefixer.clone(node, overrides)
|
|
141
141
|
}
|
|
142
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
|
|
@@ -497,6 +497,9 @@ class Processor {
|
|
|
497
497
|
return true
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
+
if (node.type === 'decl' && node.prop === 'content') {
|
|
501
|
+
return true
|
|
502
|
+
}
|
|
500
503
|
|
|
501
504
|
return this.disabled(node, result)
|
|
502
505
|
}
|
|
@@ -504,7 +507,7 @@ class Processor {
|
|
|
504
507
|
/**
|
|
505
508
|
* Check for grid/flexbox options.
|
|
506
509
|
*/
|
|
507
|
-
disabledDecl
|
|
510
|
+
disabledDecl(node, result) {
|
|
508
511
|
if (this.gridStatus(node, result) === false && node.type === 'decl') {
|
|
509
512
|
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
|
510
513
|
return true
|
|
@@ -523,7 +526,7 @@ class Processor {
|
|
|
523
526
|
/**
|
|
524
527
|
* Check for control comment and global options
|
|
525
528
|
*/
|
|
526
|
-
disabled
|
|
529
|
+
disabled(node, result) {
|
|
527
530
|
if (!node) return false
|
|
528
531
|
|
|
529
532
|
if (node._autoprefixerDisabled !== undefined) {
|
|
@@ -581,7 +584,7 @@ class Processor {
|
|
|
581
584
|
/**
|
|
582
585
|
* Normalize spaces in cascade declaration group
|
|
583
586
|
*/
|
|
584
|
-
reduceSpaces
|
|
587
|
+
reduceSpaces(decl) {
|
|
585
588
|
let stop = false
|
|
586
589
|
this.prefixes.group(decl).up(() => {
|
|
587
590
|
stop = true
|
|
@@ -613,7 +616,7 @@ class Processor {
|
|
|
613
616
|
/**
|
|
614
617
|
* Is it flebox or grid rule
|
|
615
618
|
*/
|
|
616
|
-
displayType
|
|
619
|
+
displayType(decl) {
|
|
617
620
|
for (let i of decl.parent.nodes) {
|
|
618
621
|
if (i.prop !== 'display') {
|
|
619
622
|
continue
|
|
@@ -634,7 +637,7 @@ class Processor {
|
|
|
634
637
|
/**
|
|
635
638
|
* Set grid option via control comment
|
|
636
639
|
*/
|
|
637
|
-
gridStatus
|
|
640
|
+
gridStatus(node, result) {
|
|
638
641
|
if (!node) return false
|
|
639
642
|
|
|
640
643
|
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
|
|
package/lib/selector.js
CHANGED
|
@@ -6,7 +6,7 @@ let Browsers = require('./browsers')
|
|
|
6
6
|
let utils = require('./utils')
|
|
7
7
|
|
|
8
8
|
class Selector extends Prefixer {
|
|
9
|
-
constructor
|
|
9
|
+
constructor(name, prefixes, all) {
|
|
10
10
|
super(name, prefixes, all)
|
|
11
11
|
this.regexpCache = new Map()
|
|
12
12
|
}
|
|
@@ -14,7 +14,7 @@ class Selector extends Prefixer {
|
|
|
14
14
|
/**
|
|
15
15
|
* Is rule selectors need to be prefixed
|
|
16
16
|
*/
|
|
17
|
-
check
|
|
17
|
+
check(rule) {
|
|
18
18
|
if (rule.selector.includes(this.name)) {
|
|
19
19
|
return !!rule.selector.match(this.regexp())
|
|
20
20
|
}
|
|
@@ -25,14 +25,14 @@ class Selector extends Prefixer {
|
|
|
25
25
|
/**
|
|
26
26
|
* Return prefixed version of selector
|
|
27
27
|
*/
|
|
28
|
-
prefixed
|
|
28
|
+
prefixed(prefix) {
|
|
29
29
|
return this.name.replace(/^(\W*)/, `$1${prefix}`)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Lazy loadRegExp for name
|
|
34
34
|
*/
|
|
35
|
-
regexp
|
|
35
|
+
regexp(prefix) {
|
|
36
36
|
if (!this.regexpCache.has(prefix)) {
|
|
37
37
|
let name = prefix ? this.prefixed(prefix) : this.name
|
|
38
38
|
this.regexpCache.set(
|
|
@@ -47,14 +47,14 @@ class Selector extends Prefixer {
|
|
|
47
47
|
/**
|
|
48
48
|
* All possible prefixes
|
|
49
49
|
*/
|
|
50
|
-
possible
|
|
50
|
+
possible() {
|
|
51
51
|
return Browsers.prefixes()
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Return all possible selector prefixes
|
|
56
56
|
*/
|
|
57
|
-
prefixeds
|
|
57
|
+
prefixeds(rule) {
|
|
58
58
|
if (rule._autoprefixerPrefixeds) {
|
|
59
59
|
if (rule._autoprefixerPrefixeds[this.name]) {
|
|
60
60
|
return rule._autoprefixerPrefixeds
|
|
@@ -86,7 +86,7 @@ class Selector extends Prefixer {
|
|
|
86
86
|
/**
|
|
87
87
|
* Is rule already prefixed before
|
|
88
88
|
*/
|
|
89
|
-
already
|
|
89
|
+
already(rule, prefixeds, prefix) {
|
|
90
90
|
let index = rule.parent.index(rule) - 1
|
|
91
91
|
|
|
92
92
|
while (index >= 0) {
|
|
@@ -121,14 +121,14 @@ class Selector extends Prefixer {
|
|
|
121
121
|
/**
|
|
122
122
|
* Replace selectors by prefixed one
|
|
123
123
|
*/
|
|
124
|
-
replace
|
|
124
|
+
replace(selector, prefix) {
|
|
125
125
|
return selector.replace(this.regexp(), `$1${this.prefixed(prefix)}`)
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* Clone and add prefixes for at-rule
|
|
130
130
|
*/
|
|
131
|
-
add
|
|
131
|
+
add(rule, prefix) {
|
|
132
132
|
let prefixeds = this.prefixeds(rule)
|
|
133
133
|
|
|
134
134
|
if (this.already(rule, prefixeds, prefix)) {
|
|
@@ -142,7 +142,7 @@ class Selector extends Prefixer {
|
|
|
142
142
|
/**
|
|
143
143
|
* Return function to fast find prefixed selector
|
|
144
144
|
*/
|
|
145
|
-
old
|
|
145
|
+
old(prefix) {
|
|
146
146
|
return new OldSelector(this, prefix)
|
|
147
147
|
}
|
|
148
148
|
}
|