autoprefixer 10.4.13 → 10.4.15
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 -4
- package/data/prefixes.js +187 -183
- package/lib/autoprefixer.js +16 -16
- package/lib/browsers.js +13 -13
- package/lib/declaration.js +92 -92
- package/lib/hacks/align-content.js +9 -9
- package/lib/hacks/align-items.js +7 -7
- package/lib/hacks/align-self.js +7 -7
- package/lib/hacks/block-logical.js +10 -10
- package/lib/hacks/border-radius.js +7 -7
- package/lib/hacks/break-props.js +16 -16
- package/lib/hacks/display-flex.js +9 -9
- package/lib/hacks/flex-direction.js +7 -7
- package/lib/hacks/flex.js +7 -7
- package/lib/hacks/gradient.js +259 -259
- package/lib/hacks/grid-column-align.js +6 -6
- package/lib/hacks/grid-row-align.js +6 -6
- package/lib/hacks/grid-rows-columns.js +23 -23
- package/lib/hacks/grid-template-areas.js +12 -12
- package/lib/hacks/grid-template.js +9 -9
- package/lib/hacks/grid-utils.js +26 -26
- package/lib/hacks/image-rendering.js +14 -14
- package/lib/hacks/inline-logical.js +6 -6
- package/lib/hacks/intrinsic.js +17 -17
- package/lib/hacks/justify-content.js +9 -9
- package/lib/hacks/mask-composite.js +2 -2
- package/lib/hacks/order.js +7 -7
- package/lib/hacks/overscroll-behavior.js +6 -6
- package/lib/hacks/pixelated.js +10 -10
- package/lib/hacks/print-color-adjust.js +7 -7
- package/lib/hacks/transform-decl.js +25 -25
- package/lib/hacks/user-select.js +10 -10
- package/lib/hacks/writing-mode.js +4 -4
- package/lib/info.js +6 -6
- package/lib/old-selector.js +16 -16
- package/lib/prefixer.js +20 -20
- package/lib/prefixes.js +124 -124
- package/lib/processor.js +159 -159
- package/lib/resolution.js +17 -17
- package/lib/selector.js +67 -67
- package/lib/supports.js +167 -167
- package/lib/transition.js +118 -118
- package/lib/value.js +26 -26
- package/package.json +7 -3
package/lib/hacks/gradient.js
CHANGED
|
@@ -9,145 +9,79 @@ let IS_DIRECTION = /top|left|right|bottom/gi
|
|
|
9
9
|
|
|
10
10
|
class Gradient extends Value {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Do not add non-webkit prefixes for list-style and object
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
node.nodes = this.newDirection(node.nodes)
|
|
20
|
-
node.nodes = this.normalize(node.nodes, gradientName)
|
|
21
|
-
if (prefix === '-webkit- old') {
|
|
22
|
-
let changes = this.oldWebkit(node)
|
|
23
|
-
if (!changes) {
|
|
24
|
-
return false
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
node.nodes = this.convertDirection(node.nodes)
|
|
28
|
-
node.value = prefix + node.value
|
|
29
|
-
}
|
|
14
|
+
add(decl, prefix) {
|
|
15
|
+
let p = decl.prop
|
|
16
|
+
if (p.includes('mask')) {
|
|
17
|
+
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
|
18
|
+
return super.add(decl, prefix)
|
|
30
19
|
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
replaceFirst(params, ...words) {
|
|
39
|
-
let prefix = words.map(i => {
|
|
40
|
-
if (i === ' ') {
|
|
41
|
-
return { type: 'space', value: i }
|
|
20
|
+
} else if (
|
|
21
|
+
p === 'list-style' ||
|
|
22
|
+
p === 'list-style-image' ||
|
|
23
|
+
p === 'content'
|
|
24
|
+
) {
|
|
25
|
+
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
|
26
|
+
return super.add(decl, prefix)
|
|
42
27
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Convert angle unit to deg
|
|
50
|
-
*/
|
|
51
|
-
normalizeUnit(str, full) {
|
|
52
|
-
let num = parseFloat(str)
|
|
53
|
-
let deg = (num / full) * 360
|
|
54
|
-
return `${deg}deg`
|
|
28
|
+
} else {
|
|
29
|
+
return super.add(decl, prefix)
|
|
30
|
+
}
|
|
31
|
+
return undefined
|
|
55
32
|
}
|
|
56
33
|
|
|
57
34
|
/**
|
|
58
|
-
*
|
|
35
|
+
* Get div token from exists parameters
|
|
59
36
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
nodes[0].value = this.normalizeUnit(nodes[0].value, 400)
|
|
65
|
-
} else if (/-?\d+(.\d+)?rad/.test(nodes[0].value)) {
|
|
66
|
-
nodes[0].value = this.normalizeUnit(nodes[0].value, 2 * Math.PI)
|
|
67
|
-
} else if (/-?\d+(.\d+)?turn/.test(nodes[0].value)) {
|
|
68
|
-
nodes[0].value = this.normalizeUnit(nodes[0].value, 1)
|
|
69
|
-
} else if (nodes[0].value.includes('deg')) {
|
|
70
|
-
let num = parseFloat(nodes[0].value)
|
|
71
|
-
num = range.wrap(0, 360, num)
|
|
72
|
-
nodes[0].value = `${num}deg`
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
gradientName === 'linear-gradient' ||
|
|
77
|
-
gradientName === 'repeating-linear-gradient'
|
|
78
|
-
) {
|
|
79
|
-
let direction = nodes[0].value
|
|
80
|
-
|
|
81
|
-
// Unitless zero for `<angle>` values are allowed in CSS gradients and transforms.
|
|
82
|
-
// Spec: https://github.com/w3c/csswg-drafts/commit/602789171429b2231223ab1e5acf8f7f11652eb3
|
|
83
|
-
if (direction === '0deg' || direction === '0') {
|
|
84
|
-
nodes = this.replaceFirst(nodes, 'to', ' ', 'top')
|
|
85
|
-
} else if (direction === '90deg') {
|
|
86
|
-
nodes = this.replaceFirst(nodes, 'to', ' ', 'right')
|
|
87
|
-
} else if (direction === '180deg') {
|
|
88
|
-
nodes = this.replaceFirst(nodes, 'to', ' ', 'bottom') // default value
|
|
89
|
-
} else if (direction === '270deg') {
|
|
90
|
-
nodes = this.replaceFirst(nodes, 'to', ' ', 'left')
|
|
37
|
+
cloneDiv(params) {
|
|
38
|
+
for (let i of params) {
|
|
39
|
+
if (i.type === 'div' && i.value === ',') {
|
|
40
|
+
return i
|
|
91
41
|
}
|
|
92
42
|
}
|
|
93
|
-
|
|
94
|
-
return nodes
|
|
43
|
+
return { after: ' ', type: 'div', value: ',' }
|
|
95
44
|
}
|
|
96
45
|
|
|
97
46
|
/**
|
|
98
|
-
*
|
|
47
|
+
* Change colors syntax to old webkit
|
|
99
48
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
params.unshift(
|
|
110
|
-
{
|
|
111
|
-
type: 'word',
|
|
112
|
-
value: 'to'
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: 'space',
|
|
116
|
-
value: ' '
|
|
49
|
+
colorStops(params) {
|
|
50
|
+
let result = []
|
|
51
|
+
for (let i = 0; i < params.length; i++) {
|
|
52
|
+
let pos
|
|
53
|
+
let param = params[i]
|
|
54
|
+
let item
|
|
55
|
+
if (i === 0) {
|
|
56
|
+
continue
|
|
117
57
|
}
|
|
118
|
-
)
|
|
119
58
|
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
params[i].value = this.revertDirection(params[i].value)
|
|
59
|
+
let color = parser.stringify(param[0])
|
|
60
|
+
if (param[1] && param[1].type === 'word') {
|
|
61
|
+
pos = param[1].value
|
|
62
|
+
} else if (param[2] && param[2].type === 'word') {
|
|
63
|
+
pos = param[2].value
|
|
126
64
|
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return params
|
|
130
|
-
}
|
|
131
65
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
state = 'at'
|
|
140
|
-
} else if (state === 'at' && param.value === 'at') {
|
|
141
|
-
state = 'after'
|
|
142
|
-
} else if (state === 'after' && param.type === 'space') {
|
|
143
|
-
return true
|
|
144
|
-
} else if (param.type === 'div') {
|
|
145
|
-
break
|
|
66
|
+
let stop
|
|
67
|
+
if (i === 1 && (!pos || pos === '0%')) {
|
|
68
|
+
stop = `from(${color})`
|
|
69
|
+
} else if (i === params.length - 1 && (!pos || pos === '100%')) {
|
|
70
|
+
stop = `to(${color})`
|
|
71
|
+
} else if (pos) {
|
|
72
|
+
stop = `color-stop(${pos}, ${color})`
|
|
146
73
|
} else {
|
|
147
|
-
|
|
74
|
+
stop = `color-stop(${color})`
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let div = param[param.length - 1]
|
|
78
|
+
params[i] = [{ type: 'word', value: stop }]
|
|
79
|
+
if (div.type === 'div' && div.value === ',') {
|
|
80
|
+
item = params[i].push(div)
|
|
148
81
|
}
|
|
82
|
+
result.push(item)
|
|
149
83
|
}
|
|
150
|
-
return
|
|
84
|
+
return result
|
|
151
85
|
}
|
|
152
86
|
|
|
153
87
|
/**
|
|
@@ -166,6 +100,17 @@ class Gradient extends Value {
|
|
|
166
100
|
return params
|
|
167
101
|
}
|
|
168
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Add 90 degrees
|
|
105
|
+
*/
|
|
106
|
+
fixAngle(params) {
|
|
107
|
+
let first = params[0].value
|
|
108
|
+
first = parseFloat(first)
|
|
109
|
+
first = Math.abs(450 - first) % 360
|
|
110
|
+
first = this.roundFloat(first, 3)
|
|
111
|
+
params[0].value = `${first}deg`
|
|
112
|
+
}
|
|
113
|
+
|
|
169
114
|
/**
|
|
170
115
|
* Replace `to top left` to `bottom right`
|
|
171
116
|
*/
|
|
@@ -182,17 +127,6 @@ class Gradient extends Value {
|
|
|
182
127
|
}
|
|
183
128
|
}
|
|
184
129
|
|
|
185
|
-
/**
|
|
186
|
-
* Add 90 degrees
|
|
187
|
-
*/
|
|
188
|
-
fixAngle(params) {
|
|
189
|
-
let first = params[0].value
|
|
190
|
-
first = parseFloat(first)
|
|
191
|
-
first = Math.abs(450 - first) % 360
|
|
192
|
-
first = this.roundFloat(first, 3)
|
|
193
|
-
params[0].value = `${first}deg`
|
|
194
|
-
}
|
|
195
|
-
|
|
196
130
|
/**
|
|
197
131
|
* Fix radial direction syntax
|
|
198
132
|
*/
|
|
@@ -226,61 +160,136 @@ class Gradient extends Value {
|
|
|
226
160
|
params.splice(0, i, ...second, div, ...first)
|
|
227
161
|
}
|
|
228
162
|
|
|
229
|
-
|
|
230
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Look for at word
|
|
165
|
+
*/
|
|
166
|
+
isRadial(params) {
|
|
167
|
+
let state = 'before'
|
|
168
|
+
for (let param of params) {
|
|
169
|
+
if (state === 'before' && param.type === 'space') {
|
|
170
|
+
state = 'at'
|
|
171
|
+
} else if (state === 'at' && param.value === 'at') {
|
|
172
|
+
state = 'after'
|
|
173
|
+
} else if (state === 'after' && param.type === 'space') {
|
|
174
|
+
return true
|
|
175
|
+
} else if (param.type === 'div') {
|
|
176
|
+
break
|
|
177
|
+
} else {
|
|
178
|
+
state = 'before'
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return false
|
|
231
182
|
}
|
|
232
183
|
|
|
233
184
|
/**
|
|
234
|
-
*
|
|
185
|
+
* Replace old direction to new
|
|
235
186
|
*/
|
|
236
|
-
|
|
237
|
-
|
|
187
|
+
newDirection(params) {
|
|
188
|
+
if (params[0].value === 'to') {
|
|
189
|
+
return params
|
|
190
|
+
}
|
|
191
|
+
IS_DIRECTION.lastIndex = 0 // reset search index of global regexp
|
|
192
|
+
if (!IS_DIRECTION.test(params[0].value)) {
|
|
193
|
+
return params
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
params.unshift(
|
|
197
|
+
{
|
|
198
|
+
type: 'word',
|
|
199
|
+
value: 'to'
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
type: 'space',
|
|
203
|
+
value: ' '
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
for (let i = 2; i < params.length; i++) {
|
|
208
|
+
if (params[i].type === 'div') {
|
|
209
|
+
break
|
|
210
|
+
}
|
|
211
|
+
if (params[i].type === 'word') {
|
|
212
|
+
params[i].value = this.revertDirection(params[i].value)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return params
|
|
238
217
|
}
|
|
239
218
|
|
|
240
219
|
/**
|
|
241
|
-
*
|
|
220
|
+
* Normalize angle
|
|
242
221
|
*/
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
let string = parser.stringify(node.nodes)
|
|
222
|
+
normalize(nodes, gradientName) {
|
|
223
|
+
if (!nodes[0]) return nodes
|
|
246
224
|
|
|
247
|
-
if (
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
225
|
+
if (/-?\d+(.\d+)?grad/.test(nodes[0].value)) {
|
|
226
|
+
nodes[0].value = this.normalizeUnit(nodes[0].value, 400)
|
|
227
|
+
} else if (/-?\d+(.\d+)?rad/.test(nodes[0].value)) {
|
|
228
|
+
nodes[0].value = this.normalizeUnit(nodes[0].value, 2 * Math.PI)
|
|
229
|
+
} else if (/-?\d+(.\d+)?turn/.test(nodes[0].value)) {
|
|
230
|
+
nodes[0].value = this.normalizeUnit(nodes[0].value, 1)
|
|
231
|
+
} else if (nodes[0].value.includes('deg')) {
|
|
232
|
+
let num = parseFloat(nodes[0].value)
|
|
233
|
+
num = range.wrap(0, 360, num)
|
|
234
|
+
nodes[0].value = `${num}deg`
|
|
252
235
|
}
|
|
236
|
+
|
|
253
237
|
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
string.includes('-side')
|
|
238
|
+
gradientName === 'linear-gradient' ||
|
|
239
|
+
gradientName === 'repeating-linear-gradient'
|
|
257
240
|
) {
|
|
258
|
-
|
|
259
|
-
}
|
|
241
|
+
let direction = nodes[0].value
|
|
260
242
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
243
|
+
// Unitless zero for `<angle>` values are allowed in CSS gradients and transforms.
|
|
244
|
+
// Spec: https://github.com/w3c/csswg-drafts/commit/602789171429b2231223ab1e5acf8f7f11652eb3
|
|
245
|
+
if (direction === '0deg' || direction === '0') {
|
|
246
|
+
nodes = this.replaceFirst(nodes, 'to', ' ', 'top')
|
|
247
|
+
} else if (direction === '90deg') {
|
|
248
|
+
nodes = this.replaceFirst(nodes, 'to', ' ', 'right')
|
|
249
|
+
} else if (direction === '180deg') {
|
|
250
|
+
nodes = this.replaceFirst(nodes, 'to', ' ', 'bottom') // default value
|
|
251
|
+
} else if (direction === '270deg') {
|
|
252
|
+
nodes = this.replaceFirst(nodes, 'to', ' ', 'left')
|
|
266
253
|
}
|
|
267
254
|
}
|
|
268
255
|
|
|
269
|
-
|
|
270
|
-
|
|
256
|
+
return nodes
|
|
257
|
+
}
|
|
271
258
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
259
|
+
/**
|
|
260
|
+
* Convert angle unit to deg
|
|
261
|
+
*/
|
|
262
|
+
normalizeUnit(str, full) {
|
|
263
|
+
let num = parseFloat(str)
|
|
264
|
+
let deg = (num / full) * 360
|
|
265
|
+
return `${deg}deg`
|
|
266
|
+
}
|
|
276
267
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Remove old WebKit gradient too
|
|
270
|
+
*/
|
|
271
|
+
old(prefix) {
|
|
272
|
+
if (prefix === '-webkit-') {
|
|
273
|
+
let type
|
|
274
|
+
if (this.name === 'linear-gradient') {
|
|
275
|
+
type = 'linear'
|
|
276
|
+
} else if (this.name === 'repeating-linear-gradient') {
|
|
277
|
+
type = 'repeating-linear'
|
|
278
|
+
} else if (this.name === 'repeating-radial-gradient') {
|
|
279
|
+
type = 'repeating-radial'
|
|
280
|
+
} else {
|
|
281
|
+
type = 'radial'
|
|
282
|
+
}
|
|
283
|
+
let string = '-gradient'
|
|
284
|
+
let regexp = utils.regexp(
|
|
285
|
+
`-webkit-(${type}-gradient|gradient\\(\\s*${type})`,
|
|
286
|
+
false
|
|
287
|
+
)
|
|
282
288
|
|
|
283
|
-
|
|
289
|
+
return new OldValue(this.name, prefix + this.name, string, regexp)
|
|
290
|
+
} else {
|
|
291
|
+
return super.old(prefix)
|
|
292
|
+
}
|
|
284
293
|
}
|
|
285
294
|
|
|
286
295
|
/**
|
|
@@ -311,106 +320,97 @@ class Gradient extends Value {
|
|
|
311
320
|
}
|
|
312
321
|
|
|
313
322
|
/**
|
|
314
|
-
*
|
|
323
|
+
* Convert to old webkit syntax
|
|
315
324
|
*/
|
|
316
|
-
|
|
317
|
-
|
|
325
|
+
oldWebkit(node) {
|
|
326
|
+
let { nodes } = node
|
|
327
|
+
let string = parser.stringify(node.nodes)
|
|
328
|
+
|
|
329
|
+
if (this.name !== 'linear-gradient') {
|
|
330
|
+
return false
|
|
331
|
+
}
|
|
332
|
+
if (nodes[0] && nodes[0].value.includes('deg')) {
|
|
333
|
+
return false
|
|
334
|
+
}
|
|
335
|
+
if (
|
|
336
|
+
string.includes('px') ||
|
|
337
|
+
string.includes('-corner') ||
|
|
338
|
+
string.includes('-side')
|
|
339
|
+
) {
|
|
340
|
+
return false
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
let params = [[]]
|
|
344
|
+
for (let i of nodes) {
|
|
345
|
+
params[params.length - 1].push(i)
|
|
318
346
|
if (i.type === 'div' && i.value === ',') {
|
|
319
|
-
|
|
347
|
+
params.push([])
|
|
320
348
|
}
|
|
321
349
|
}
|
|
322
|
-
return { type: 'div', value: ',', after: ' ' }
|
|
323
|
-
}
|
|
324
350
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
*/
|
|
328
|
-
colorStops(params) {
|
|
329
|
-
let result = []
|
|
330
|
-
for (let i = 0; i < params.length; i++) {
|
|
331
|
-
let pos
|
|
332
|
-
let param = params[i]
|
|
333
|
-
let item
|
|
334
|
-
if (i === 0) {
|
|
335
|
-
continue
|
|
336
|
-
}
|
|
351
|
+
this.oldDirection(params)
|
|
352
|
+
this.colorStops(params)
|
|
337
353
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
pos = param[2].value
|
|
343
|
-
}
|
|
354
|
+
node.nodes = []
|
|
355
|
+
for (let param of params) {
|
|
356
|
+
node.nodes = node.nodes.concat(param)
|
|
357
|
+
}
|
|
344
358
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
} else if (pos) {
|
|
351
|
-
stop = `color-stop(${pos}, ${color})`
|
|
352
|
-
} else {
|
|
353
|
-
stop = `color-stop(${color})`
|
|
354
|
-
}
|
|
359
|
+
node.nodes.unshift(
|
|
360
|
+
{ type: 'word', value: 'linear' },
|
|
361
|
+
this.cloneDiv(node.nodes)
|
|
362
|
+
)
|
|
363
|
+
node.value = '-webkit-gradient'
|
|
355
364
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
365
|
+
return true
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Change degrees for webkit prefix
|
|
370
|
+
*/
|
|
371
|
+
replace(string, prefix) {
|
|
372
|
+
let ast = parser(string)
|
|
373
|
+
for (let node of ast.nodes) {
|
|
374
|
+
let gradientName = this.name // gradient name
|
|
375
|
+
if (node.type === 'function' && node.value === gradientName) {
|
|
376
|
+
node.nodes = this.newDirection(node.nodes)
|
|
377
|
+
node.nodes = this.normalize(node.nodes, gradientName)
|
|
378
|
+
if (prefix === '-webkit- old') {
|
|
379
|
+
let changes = this.oldWebkit(node)
|
|
380
|
+
if (!changes) {
|
|
381
|
+
return false
|
|
382
|
+
}
|
|
383
|
+
} else {
|
|
384
|
+
node.nodes = this.convertDirection(node.nodes)
|
|
385
|
+
node.value = prefix + node.value
|
|
386
|
+
}
|
|
360
387
|
}
|
|
361
|
-
result.push(item)
|
|
362
388
|
}
|
|
363
|
-
return
|
|
389
|
+
return ast.toString()
|
|
364
390
|
}
|
|
365
391
|
|
|
366
392
|
/**
|
|
367
|
-
*
|
|
393
|
+
* Replace first token
|
|
368
394
|
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
type = 'linear'
|
|
374
|
-
} else if (this.name === 'repeating-linear-gradient') {
|
|
375
|
-
type = 'repeating-linear'
|
|
376
|
-
} else if (this.name === 'repeating-radial-gradient') {
|
|
377
|
-
type = 'repeating-radial'
|
|
378
|
-
} else {
|
|
379
|
-
type = 'radial'
|
|
395
|
+
replaceFirst(params, ...words) {
|
|
396
|
+
let prefix = words.map(i => {
|
|
397
|
+
if (i === ' ') {
|
|
398
|
+
return { type: 'space', value: i }
|
|
380
399
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
)
|
|
400
|
+
return { type: 'word', value: i }
|
|
401
|
+
})
|
|
402
|
+
return prefix.concat(params.slice(1))
|
|
403
|
+
}
|
|
386
404
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
return super.old(prefix)
|
|
390
|
-
}
|
|
405
|
+
revertDirection(word) {
|
|
406
|
+
return Gradient.directions[word.toLowerCase()] || word
|
|
391
407
|
}
|
|
392
408
|
|
|
393
409
|
/**
|
|
394
|
-
*
|
|
410
|
+
* Round float and save digits under dot
|
|
395
411
|
*/
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if (p.includes('mask')) {
|
|
399
|
-
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
|
400
|
-
return super.add(decl, prefix)
|
|
401
|
-
}
|
|
402
|
-
} else if (
|
|
403
|
-
p === 'list-style' ||
|
|
404
|
-
p === 'list-style-image' ||
|
|
405
|
-
p === 'content'
|
|
406
|
-
) {
|
|
407
|
-
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
|
408
|
-
return super.add(decl, prefix)
|
|
409
|
-
}
|
|
410
|
-
} else {
|
|
411
|
-
return super.add(decl, prefix)
|
|
412
|
-
}
|
|
413
|
-
return undefined
|
|
412
|
+
roundFloat(float, digits) {
|
|
413
|
+
return parseFloat(float.toFixed(digits))
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
|
|
@@ -422,27 +422,27 @@ Gradient.names = [
|
|
|
422
422
|
]
|
|
423
423
|
|
|
424
424
|
Gradient.directions = {
|
|
425
|
-
top: 'bottom', // default value
|
|
426
|
-
left: 'right',
|
|
427
425
|
bottom: 'top',
|
|
428
|
-
|
|
426
|
+
left: 'right',
|
|
427
|
+
right: 'left',
|
|
428
|
+
top: 'bottom' // default value
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
// Direction to replace
|
|
432
432
|
Gradient.oldDirections = {
|
|
433
|
-
'top': 'left bottom, left top',
|
|
434
|
-
'left': 'right top, left top',
|
|
435
433
|
'bottom': 'left top, left bottom',
|
|
436
|
-
'right': 'left top, right top',
|
|
437
|
-
|
|
438
|
-
'top right': 'left bottom, right top',
|
|
439
|
-
'top left': 'right bottom, left top',
|
|
440
|
-
'right top': 'left bottom, right top',
|
|
441
|
-
'right bottom': 'left top, right bottom',
|
|
442
|
-
'bottom right': 'left top, right bottom',
|
|
443
434
|
'bottom left': 'right top, left bottom',
|
|
435
|
+
'bottom right': 'left top, right bottom',
|
|
436
|
+
'left': 'right top, left top',
|
|
437
|
+
|
|
438
|
+
'left bottom': 'right top, left bottom',
|
|
444
439
|
'left top': 'right bottom, left top',
|
|
445
|
-
'
|
|
440
|
+
'right': 'left top, right top',
|
|
441
|
+
'right bottom': 'left top, right bottom',
|
|
442
|
+
'right top': 'left bottom, right top',
|
|
443
|
+
'top': 'left bottom, left top',
|
|
444
|
+
'top left': 'right bottom, left top',
|
|
445
|
+
'top right': 'left bottom, right top'
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
module.exports = Gradient
|
|
@@ -9,17 +9,17 @@ class GridColumnAlign extends Declaration {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Change property
|
|
12
|
+
* Change IE property back
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
return
|
|
14
|
+
normalize() {
|
|
15
|
+
return 'justify-self'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Change
|
|
19
|
+
* Change property name for IE
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
return '
|
|
21
|
+
prefixed(prop, prefix) {
|
|
22
|
+
return prefix + 'grid-column-align'
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -9,17 +9,17 @@ class GridRowAlign extends Declaration {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Change property
|
|
12
|
+
* Change IE property back
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
return
|
|
14
|
+
normalize() {
|
|
15
|
+
return 'align-self'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Change
|
|
19
|
+
* Change property name for IE
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
return 'align
|
|
21
|
+
prefixed(prop, prefix) {
|
|
22
|
+
return prefix + 'grid-row-align'
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|