autoprefixer 10.4.27 → 10.5.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
3
+ Copyright 2013 Andrey Sitnik <andrey@sitnik.es>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -46,12 +46,8 @@ Twitter account for news and releases: [@autoprefixer].
46
46
  </a>
47
47
 
48
48
  [interactive demo]: https://autoprefixer.github.io/
49
- [@autoprefixer]: https://twitter.com/autoprefixer
50
- [Can I Use]: https://caniuse.com/
51
- [cult-img]: https://cultofmartians.com/assets/badges/badge.svg
52
- [PostCSS]: https://github.com/postcss/postcss
53
- [cult]: https://cultofmartians.com/tasks/autoprefixer-grid.html
54
-
55
-
56
- ## Docs
57
- Read full docs **[here](https://github.com/postcss/autoprefixer#readme)**.
49
+ [@autoprefixer]: https://twitter.com/autoprefixer
50
+ [Can I Use]: https://caniuse.com/
51
+ [cult-img]: https://cultofmartians.com/assets/badges/badge.svg
52
+ [PostCSS]: https://github.com/postcss/postcss
53
+ [cult]: https://cultofmartians.com/tasks/autoprefixer-grid.html
package/data/prefixes.js CHANGED
@@ -750,6 +750,8 @@ f(prefixCssMasks, browsers => {
750
750
  [
751
751
  'mask',
752
752
  'mask-position',
753
+ 'mask-position-x',
754
+ 'mask-position-y',
753
755
  'mask-size',
754
756
  'mask-border',
755
757
  'mask-border-outset',
@@ -1,5 +1,5 @@
1
- import { Plugin } from 'postcss'
2
1
  import { Stats } from 'browserslist'
2
+ import { Plugin } from 'postcss'
3
3
 
4
4
  declare function autoprefixer<T extends string[]>(
5
5
  ...args: [...T, autoprefixer.Options]
@@ -4,7 +4,7 @@ let OldValue = require('../old-value')
4
4
  let utils = require('../utils')
5
5
  let Value = require('../value')
6
6
 
7
- let IS_DIRECTION = /top|left|right|bottom/gi
7
+ const IS_DIRECTION = /top|left|right|bottom/gi
8
8
 
9
9
  class Gradient extends Value {
10
10
  /**
@@ -229,7 +229,7 @@ class Gradient extends Value {
229
229
  nodes[0].value = this.normalizeUnit(nodes[0].value, 1)
230
230
  } else if (nodes[0].value.includes('deg')) {
231
231
  let num = parseFloat(nodes[0].value)
232
- num = (num % 360 + 360) % 360
232
+ num = ((num % 360) + 360) % 360
233
233
  nodes[0].value = `${num}deg`
234
234
  }
235
235
 
@@ -164,7 +164,7 @@ function prefixTrackValue({ gap, value }) {
164
164
 
165
165
  // Parse grid-template-areas
166
166
 
167
- let DOTS = /^\.+$/
167
+ const DOTS = /^\.+$/
168
168
 
169
169
  function track(start, end) {
170
170
  return { end, span: end - start, start }
@@ -358,6 +358,30 @@ function selectorsEqual(ruleA, ruleB) {
358
358
  })
359
359
  }
360
360
 
361
+ function selectorStartsWith(base, selector) {
362
+ if (!selector.startsWith(base)) {
363
+ return false
364
+ }
365
+
366
+ let next = selector[base.length]
367
+ return !next || /[\s.#[:>+~]/.test(next)
368
+ }
369
+
370
+ function selectorMayOverlap(previous, current) {
371
+ let base = previous.replace(/\s*\*\s*/g, ' ').replace(/\s+/g, ' ').trim()
372
+ let selector = current.replace(/\s+/g, ' ').trim()
373
+
374
+ return !base || selectorStartsWith(base, selector)
375
+ }
376
+
377
+ function selectorsMayOverlap(previous, current) {
378
+ return previous.some(previousSelector => {
379
+ return current.some(currentSelector => {
380
+ return selectorMayOverlap(previousSelector, currentSelector)
381
+ })
382
+ })
383
+ }
384
+
361
385
  /**
362
386
  * Parse data from all grid-template(-areas) declarations
363
387
  * @param {Root} css css root
@@ -483,6 +507,7 @@ function insertAreas(css, isDisabled) {
483
507
 
484
508
  // we need to store the rules that we will insert later
485
509
  let rulesToInsert = {}
510
+ let previousGridAreas = []
486
511
 
487
512
  css.walkDecls('grid-area', gridArea => {
488
513
  let gridAreaRule = gridArea.parent
@@ -515,6 +540,20 @@ function insertAreas(css, isDisabled) {
515
540
  return false
516
541
  }
517
542
 
543
+ function shouldResetSpan(rule, area, dimension) {
544
+ return previousGridAreas.some(previous => {
545
+ if (previous.data !== data) {
546
+ return false
547
+ }
548
+ if (!selectorsMayOverlap(previous.selectors, gridAreaRule.selectors)) {
549
+ return false
550
+ }
551
+
552
+ let previousArea = rule.areas[previous.value]
553
+ return previousArea && previousArea[dimension].span > area[dimension].span
554
+ })
555
+ }
556
+
518
557
  // create the empty object with the key as the last area name
519
558
  // e.g if we have templates with "a b c" values, "c" will be the last area
520
559
  if (!rulesToInsert[lastArea]) {
@@ -553,8 +592,10 @@ function insertAreas(css, isDisabled) {
553
592
 
554
593
  if ((!rule.hasDuplicates || !hasDuplicateName) && !rule.params) {
555
594
  // grid-template has no duplicates and not inside media rule
595
+ let addRowSpan = shouldResetSpan(rule, area, 'row')
596
+ let addColumnSpan = shouldResetSpan(rule, area, 'column')
556
597
 
557
- getMSDecls(area, false, false)
598
+ getMSDecls(area, addRowSpan, addColumnSpan)
558
599
  .reverse()
559
600
  .forEach(i =>
560
601
  gridAreaRule.prepend(
@@ -572,8 +613,11 @@ function insertAreas(css, isDisabled) {
572
613
  // grid-template has duplicates and not inside media rule
573
614
  let cloned = gridAreaRule.clone()
574
615
  cloned.removeAll()
616
+ let addRowSpan = area.row.updateSpan || shouldResetSpan(rule, area, 'row')
617
+ let addColumnSpan =
618
+ area.column.updateSpan || shouldResetSpan(rule, area, 'column')
575
619
 
576
- getMSDecls(area, area.row.updateSpan, area.column.updateSpan)
620
+ getMSDecls(area, addRowSpan, addColumnSpan)
577
621
  .reverse()
578
622
  .forEach(i =>
579
623
  cloned.prepend(
@@ -604,7 +648,11 @@ function insertAreas(css, isDisabled) {
604
648
  // grid-template has duplicates and not inside media rule
605
649
  // and the selector is complex
606
650
  gridAreaRule.walkDecls(/-ms-grid-(row|column)/, d => d.remove())
607
- getMSDecls(area, area.row.updateSpan, area.column.updateSpan)
651
+ let addRowSpan = area.row.updateSpan || shouldResetSpan(rule, area, 'row')
652
+ let addColumnSpan =
653
+ area.column.updateSpan || shouldResetSpan(rule, area, 'column')
654
+
655
+ getMSDecls(area, addRowSpan, addColumnSpan)
608
656
  .reverse()
609
657
  .forEach(i =>
610
658
  gridAreaRule.prepend(
@@ -622,8 +670,11 @@ function insertAreas(css, isDisabled) {
622
670
  // rules and merge them easily
623
671
  let cloned = gridAreaRule.clone()
624
672
  cloned.removeAll()
673
+ let addRowSpan = area.row.updateSpan || shouldResetSpan(rule, area, 'row')
674
+ let addColumnSpan =
675
+ area.column.updateSpan || shouldResetSpan(rule, area, 'column')
625
676
 
626
- getMSDecls(area, area.row.updateSpan, area.column.updateSpan)
677
+ getMSDecls(area, addRowSpan, addColumnSpan)
627
678
  .reverse()
628
679
  .forEach(i =>
629
680
  cloned.prepend(
@@ -661,6 +712,12 @@ function insertAreas(css, isDisabled) {
661
712
  }
662
713
  }
663
714
 
715
+ previousGridAreas.push({
716
+ data,
717
+ selectors: gridAreaRule.selectors,
718
+ value
719
+ })
720
+
664
721
  return undefined
665
722
  })
666
723
 
package/lib/prefixes.js CHANGED
@@ -192,7 +192,7 @@ class Prefixes {
192
192
  return true
193
193
  }
194
194
 
195
- if (step === +1 && other.prop === unprefixed) {
195
+ if (step === 1 && other.prop === unprefixed) {
196
196
  if (!Browsers.withPrefix(other.value)) {
197
197
  break
198
198
  }
@@ -206,7 +206,7 @@ class Prefixes {
206
206
 
207
207
  return {
208
208
  down(callback) {
209
- return checker(+1, callback)
209
+ return checker(1, callback)
210
210
  },
211
211
  up(callback) {
212
212
  return checker(-1, callback)
package/lib/processor.js CHANGED
@@ -35,6 +35,17 @@ function hasRowsAndColumns(decl) {
35
35
  return hasRows && hasColumns
36
36
  }
37
37
 
38
+ function insideGrid(decl) {
39
+ return decl.parent.nodes.some(node => {
40
+ if (node.type !== 'decl') return false
41
+ let displayGrid =
42
+ node.prop === 'display' && /(inline-)?grid/.test(node.value)
43
+ let gridTemplate = node.prop.startsWith('grid-template')
44
+ let gridGap = /^grid-([A-z]+-)?gap/.test(node.prop)
45
+ return displayGrid || gridTemplate || gridGap
46
+ })
47
+ }
48
+
38
49
  class Processor {
39
50
  constructor(prefixes) {
40
51
  this.prefixes = prefixes
@@ -84,17 +95,6 @@ class Processor {
84
95
  })
85
96
  })
86
97
 
87
- function insideGrid(decl) {
88
- return decl.parent.nodes.some(node => {
89
- if (node.type !== 'decl') return false
90
- let displayGrid =
91
- node.prop === 'display' && /(inline-)?grid/.test(node.value)
92
- let gridTemplate = node.prop.startsWith('grid-template')
93
- let gridGap = /^grid-([A-z]+-)?gap/.test(node.prop)
94
- return displayGrid || gridTemplate || gridGap
95
- })
96
- }
97
-
98
98
  let gridPrefixes =
99
99
  this.gridStatus(css, result) &&
100
100
  this.prefixes.add['grid-area'] &&
@@ -586,6 +586,7 @@ class Processor {
586
586
 
587
587
  let parts = decl.raw('before').split('\n')
588
588
  let prevMin = parts[parts.length - 1].length
589
+ /** @type {number|false} */
589
590
  let diff = false
590
591
 
591
592
  this.prefixes.group(decl).down(other => {
package/lib/supports.js CHANGED
@@ -211,7 +211,8 @@ class Supports {
211
211
  let browsers = new Browsers(
212
212
  this.all.browsers.data,
213
213
  filtered,
214
- this.all.options
214
+ this.all.options,
215
+ this.all.browsers.browserslistOpts
215
216
  )
216
217
  this.prefixerCache = new this.Prefixes(
217
218
  this.all.data,
package/lib/transition.js CHANGED
@@ -320,7 +320,7 @@ class Transition {
320
320
  nodes = nodes.slice(1)
321
321
  }
322
322
  if (nodes[nodes.length - 1].type === 'div') {
323
- nodes = nodes.slice(0, +-2 + 1 || undefined)
323
+ nodes = nodes.slice(0, -1)
324
324
  }
325
325
  return parser.stringify({ nodes })
326
326
  }
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "10.4.27",
3
+ "version": "10.5.1",
4
4
  "description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
5
- "engines": {
6
- "node": "^10 || ^12 || >=14"
7
- },
8
5
  "keywords": [
9
6
  "autoprefixer",
10
7
  "css",
11
- "prefix",
12
8
  "postcss",
13
- "postcss-plugin"
9
+ "postcss-plugin",
10
+ "prefix"
14
11
  ],
15
- "main": "lib/autoprefixer.js",
16
- "bin": "bin/autoprefixer",
17
- "types": "lib/autoprefixer.d.ts",
12
+ "bugs": {
13
+ "url": "https://github.com/postcss/autoprefixer/issues"
14
+ },
15
+ "license": "MIT",
16
+ "author": "Andrey Sitnik <andrey@sitnik.es>",
17
+ "repository": "postcss/autoprefixer",
18
18
  "funding": [
19
19
  {
20
20
  "type": "opencollective",
@@ -29,20 +29,20 @@
29
29
  "url": "https://github.com/sponsors/ai"
30
30
  }
31
31
  ],
32
- "author": "Andrey Sitnik <andrey@sitnik.ru>",
33
- "license": "MIT",
34
- "repository": "postcss/autoprefixer",
35
- "bugs": {
36
- "url": "https://github.com/postcss/autoprefixer/issues"
37
- },
38
- "peerDependencies": {
39
- "postcss": "^8.1.0"
40
- },
32
+ "bin": "bin/autoprefixer",
33
+ "main": "lib/autoprefixer.js",
34
+ "types": "lib/autoprefixer.d.ts",
41
35
  "dependencies": {
42
- "browserslist": "^4.28.1",
43
- "caniuse-lite": "^1.0.30001774",
36
+ "browserslist": "^4.28.4",
37
+ "caniuse-lite": "^1.0.30001799",
44
38
  "fraction.js": "^5.3.4",
45
39
  "picocolors": "^1.1.1",
46
40
  "postcss-value-parser": "^4.2.0"
41
+ },
42
+ "peerDependencies": {
43
+ "postcss": "^8.1.0"
44
+ },
45
+ "engines": {
46
+ "node": "^10 || ^12 || >=14"
47
47
  }
48
48
  }