autoprefixer 10.4.10 → 10.4.12

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/data/prefixes.js CHANGED
@@ -659,21 +659,6 @@ f(prefixPointer, browsers =>
659
659
  // Text decoration
660
660
  let prefixDecoration = require('caniuse-lite/data/features/text-decoration')
661
661
 
662
- f(prefixDecoration, browsers =>
663
- prefix(
664
- [
665
- 'text-decoration-style',
666
- 'text-decoration-color',
667
- 'text-decoration-line',
668
- 'text-decoration'
669
- ],
670
- {
671
- feature: 'text-decoration',
672
- browsers
673
- }
674
- )
675
- )
676
-
677
662
  f(prefixDecoration, { match: /x.*#[235]/ }, browsers =>
678
663
  prefix(['text-decoration-skip', 'text-decoration-skip-ink'], {
679
664
  feature: 'text-decoration',
@@ -681,6 +666,42 @@ f(prefixDecoration, { match: /x.*#[235]/ }, browsers =>
681
666
  })
682
667
  )
683
668
 
669
+ let prefixDecorationShorthand = require('caniuse-lite/data/features/mdn-text-decoration-shorthand')
670
+
671
+ f(prefixDecorationShorthand, browsers =>
672
+ prefix(['text-decoration'], {
673
+ feature: 'text-decoration',
674
+ browsers
675
+ })
676
+ )
677
+
678
+ let prefixDecorationColor = require('caniuse-lite/data/features/mdn-text-decoration-color')
679
+
680
+ f(prefixDecorationColor, browsers =>
681
+ prefix(['text-decoration-color'], {
682
+ feature: 'text-decoration',
683
+ browsers
684
+ })
685
+ )
686
+
687
+ let prefixDecorationLine = require('caniuse-lite/data/features/mdn-text-decoration-line')
688
+
689
+ f(prefixDecorationLine, browsers =>
690
+ prefix(['text-decoration-line'], {
691
+ feature: 'text-decoration',
692
+ browsers
693
+ })
694
+ )
695
+
696
+ let prefixDecorationStyle = require('caniuse-lite/data/features/mdn-text-decoration-style')
697
+
698
+ f(prefixDecorationStyle, browsers =>
699
+ prefix(['text-decoration-style'], {
700
+ feature: 'text-decoration',
701
+ browsers
702
+ })
703
+ )
704
+
684
705
  // Text Size Adjust
685
706
  let prefixTextSizeAdjust = require('caniuse-lite/data/features/text-size-adjust')
686
707
 
@@ -14,9 +14,10 @@ class Gradient extends Value {
14
14
  replace(string, prefix) {
15
15
  let ast = parser(string)
16
16
  for (let node of ast.nodes) {
17
- if (node.type === 'function' && node.value === this.name) {
17
+ let gradientName = this.name // gradient name
18
+ if (node.type === 'function' && node.value === gradientName) {
18
19
  node.nodes = this.newDirection(node.nodes)
19
- node.nodes = this.normalize(node.nodes)
20
+ node.nodes = this.normalize(node.nodes, gradientName)
20
21
  if (prefix === '-webkit- old') {
21
22
  let changes = this.oldWebkit(node)
22
23
  if (!changes) {
@@ -56,7 +57,7 @@ class Gradient extends Value {
56
57
  /**
57
58
  * Normalize angle
58
59
  */
59
- normalize(nodes) {
60
+ normalize(nodes, gradientName) {
60
61
  if (!nodes[0]) return nodes
61
62
 
62
63
  if (/-?\d+(.\d+)?grad/.test(nodes[0].value)) {
@@ -71,14 +72,23 @@ class Gradient extends Value {
71
72
  nodes[0].value = `${num}deg`
72
73
  }
73
74
 
74
- if (nodes[0].value === '0deg') {
75
- nodes = this.replaceFirst(nodes, 'to', ' ', 'top')
76
- } else if (nodes[0].value === '90deg') {
77
- nodes = this.replaceFirst(nodes, 'to', ' ', 'right')
78
- } else if (nodes[0].value === '180deg') {
79
- nodes = this.replaceFirst(nodes, 'to', ' ', 'bottom')
80
- } else if (nodes[0].value === '270deg') {
81
- nodes = this.replaceFirst(nodes, 'to', ' ', 'left')
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')
91
+ }
82
92
  }
83
93
 
84
94
  return nodes
@@ -358,7 +368,16 @@ class Gradient extends Value {
358
368
  */
359
369
  old(prefix) {
360
370
  if (prefix === '-webkit-') {
361
- let type = this.name === 'linear-gradient' ? 'linear' : 'radial'
371
+ let type
372
+ if (this.name === 'linear-gradient') {
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'
380
+ }
362
381
  let string = '-gradient'
363
382
  let regexp = utils.regexp(
364
383
  `-webkit-(${type}-gradient|gradient\\(\\s*${type})`,
@@ -403,7 +422,7 @@ Gradient.names = [
403
422
  ]
404
423
 
405
424
  Gradient.directions = {
406
- top: 'bottom',
425
+ top: 'bottom', // default value
407
426
  left: 'right',
408
427
  bottom: 'top',
409
428
  right: 'left'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "10.4.10",
3
+ "version": "10.4.12",
4
4
  "description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"
@@ -35,8 +35,8 @@
35
35
  "postcss": "^8.1.0"
36
36
  },
37
37
  "dependencies": {
38
- "browserslist": "^4.21.3",
39
- "caniuse-lite": "^1.0.30001399",
38
+ "browserslist": "^4.21.4",
39
+ "caniuse-lite": "^1.0.30001407",
40
40
  "fraction.js": "^4.2.0",
41
41
  "normalize-range": "^0.1.2",
42
42
  "picocolors": "^1.0.0",