tailwindcss 3.2.6 → 3.2.7

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/CHANGELOG.md CHANGED
@@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  - Nothing yet!
11
11
 
12
+ ## [3.2.7] - 2023-02-16
13
+
14
+ ### Fixed
15
+
16
+ - Fix use of `:where(.btn)` when matching `!btn` ([#10601](https://github.com/tailwindlabs/tailwindcss/pull/10601))
17
+ - Revert including `outline-color` in `transition` and `transition-colors` by default ([#10604](https://github.com/tailwindlabs/tailwindcss/pull/10604))
18
+
12
19
  ## [3.2.6] - 2023-02-08
13
20
 
14
21
  ### Fixed
@@ -2169,7 +2176,8 @@ No release notes
2169
2176
 
2170
2177
  - Everything!
2171
2178
 
2172
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.6...HEAD
2179
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.7...HEAD
2180
+ [3.2.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.6...v3.2.7
2173
2181
  [3.2.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.5...v3.2.6
2174
2182
  [3.2.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.4...v3.2.5
2175
2183
  [3.2.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.3...v3.2.4
@@ -162,12 +162,12 @@ function applyImportant(matches, classCandidate) {
162
162
  ]
163
163
  });
164
164
  container.walkRules((r)=>{
165
- r.selector = (0, _pluginUtils.updateAllClasses)((0, _pluginUtils.filterSelectorsForClass)(r.selector, classCandidate), (className)=>{
166
- if (className === classCandidate) {
167
- return `!${className}`;
168
- }
169
- return className;
170
- });
165
+ let ast = (0, _postcssSelectorParser.default)().astSync(r.selector);
166
+ // Remove extraneous selectors that do not include the base candidate
167
+ ast.each((sel)=>(0, _formatVariantSelector.eliminateIrrelevantSelectors)(sel, classCandidate));
168
+ // Update all instances of the base candidate to include the important marker
169
+ (0, _pluginUtils.updateAllClasses)(ast, (className)=>className === classCandidate ? `!${className}` : className);
170
+ r.selector = ast.toString();
171
171
  r.walkDecls((d)=>d.important = true);
172
172
  });
173
173
  result.push([
@@ -10,6 +10,7 @@ function _export(target, all) {
10
10
  }
11
11
  _export(exports, {
12
12
  formatVariantSelector: ()=>formatVariantSelector,
13
+ eliminateIrrelevantSelectors: ()=>eliminateIrrelevantSelectors,
13
14
  finalizeSelector: ()=>finalizeSelector,
14
15
  handleMergePseudo: ()=>handleMergePseudo
15
16
  });
@@ -98,18 +99,7 @@ function formatVariantSelector(formats, { context , candidate }) {
98
99
  });
99
100
  return sel;
100
101
  }
101
- /**
102
- * Remove extraneous selectors that do not include the base class/candidate
103
- *
104
- * Example:
105
- * Given the utility `.a, .b { color: red}`
106
- * Given the candidate `sm:b`
107
- *
108
- * The final selector should be `.sm\:b` and not `.a, .sm\:b`
109
- *
110
- * @param {Selector} ast
111
- * @param {string} base
112
- */ function eliminateIrrelevantSelectors(sel, base) {
102
+ function eliminateIrrelevantSelectors(sel, base) {
113
103
  let hasClassesMatchingCandidate = false;
114
104
  sel.walk((child)=>{
115
105
  if (child.type === "class" && child.value === base) {
@@ -10,7 +10,6 @@ function _export(target, all) {
10
10
  }
11
11
  _export(exports, {
12
12
  updateAllClasses: ()=>updateAllClasses,
13
- filterSelectorsForClass: ()=>filterSelectorsForClass,
14
13
  asValue: ()=>asValue,
15
14
  parseColorFormat: ()=>parseColorFormat,
16
15
  asColor: ()=>asColor,
@@ -19,7 +18,6 @@ _export(exports, {
19
18
  coerceValue: ()=>coerceValue,
20
19
  getMatchingTypes: ()=>getMatchingTypes
21
20
  });
22
- const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
23
21
  const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
24
22
  const _withAlphaVariable = require("./withAlphaVariable");
25
23
  const _dataTypes = require("./dataTypes");
@@ -32,29 +30,12 @@ function _interopRequireDefault(obj) {
32
30
  };
33
31
  }
34
32
  function updateAllClasses(selectors, updateClass) {
35
- let parser = (0, _postcssSelectorParser.default)((selectors)=>{
36
- selectors.walkClasses((sel)=>{
37
- let updatedClass = updateClass(sel.value);
38
- sel.value = updatedClass;
39
- if (sel.raws && sel.raws.value) {
40
- sel.raws.value = (0, _escapeCommas.default)(sel.raws.value);
41
- }
42
- });
43
- });
44
- let result = parser.processSync(selectors);
45
- return result;
46
- }
47
- function filterSelectorsForClass(selectors, classCandidate) {
48
- let parser = (0, _postcssSelectorParser.default)((selectors)=>{
49
- selectors.each((sel)=>{
50
- const containsClass = sel.nodes.some((node)=>node.type === "class" && node.value === classCandidate);
51
- if (!containsClass) {
52
- sel.remove();
53
- }
54
- });
33
+ selectors.walkClasses((sel)=>{
34
+ sel.value = updateClass(sel.value);
35
+ if (sel.raws && sel.raws.value) {
36
+ sel.raws.value = (0, _escapeCommas.default)(sel.raws.value);
37
+ }
55
38
  });
56
- let result = parser.processSync(selectors);
57
- return result;
58
39
  }
59
40
  function resolveArbitraryValue(modifier, validate) {
60
41
  if (!isArbitraryValue(modifier)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.2.6",
3
+ "version": "3.2.7",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -3,10 +3,14 @@ import selectorParser from 'postcss-selector-parser'
3
3
  import parseObjectStyles from '../util/parseObjectStyles'
4
4
  import isPlainObject from '../util/isPlainObject'
5
5
  import prefixSelector from '../util/prefixSelector'
6
- import { updateAllClasses, filterSelectorsForClass, getMatchingTypes } from '../util/pluginUtils'
6
+ import { updateAllClasses, getMatchingTypes } from '../util/pluginUtils'
7
7
  import log from '../util/log'
8
8
  import * as sharedState from './sharedState'
9
- import { formatVariantSelector, finalizeSelector } from '../util/formatVariantSelector'
9
+ import {
10
+ formatVariantSelector,
11
+ finalizeSelector,
12
+ eliminateIrrelevantSelectors,
13
+ } from '../util/formatVariantSelector'
10
14
  import { asClass } from '../util/nameClass'
11
15
  import { normalize } from '../util/dataTypes'
12
16
  import { isValidVariantFormatString, parseVariant } from './setupContextUtils'
@@ -111,22 +115,28 @@ function applyImportant(matches, classCandidate) {
111
115
  if (matches.length === 0) {
112
116
  return matches
113
117
  }
118
+
114
119
  let result = []
115
120
 
116
121
  for (let [meta, rule] of matches) {
117
122
  let container = postcss.root({ nodes: [rule.clone()] })
123
+
118
124
  container.walkRules((r) => {
119
- r.selector = updateAllClasses(
120
- filterSelectorsForClass(r.selector, classCandidate),
121
- (className) => {
122
- if (className === classCandidate) {
123
- return `!${className}`
124
- }
125
- return className
126
- }
125
+ let ast = selectorParser().astSync(r.selector)
126
+
127
+ // Remove extraneous selectors that do not include the base candidate
128
+ ast.each((sel) => eliminateIrrelevantSelectors(sel, classCandidate))
129
+
130
+ // Update all instances of the base candidate to include the important marker
131
+ updateAllClasses(ast, (className) =>
132
+ className === classCandidate ? `!${className}` : className
127
133
  )
134
+
135
+ r.selector = ast.toString()
136
+
128
137
  r.walkDecls((d) => (d.important = true))
129
138
  })
139
+
130
140
  result.push([{ ...meta, important: true }, container.nodes[0]])
131
141
  }
132
142
 
@@ -120,7 +120,7 @@ function resortSelector(sel) {
120
120
  * @param {Selector} ast
121
121
  * @param {string} base
122
122
  */
123
- function eliminateIrrelevantSelectors(sel, base) {
123
+ export function eliminateIrrelevantSelectors(sel, base) {
124
124
  let hasClassesMatchingCandidate = false
125
125
 
126
126
  sel.walk((child) => {
@@ -1,4 +1,3 @@
1
- import selectorParser from 'postcss-selector-parser'
2
1
  import escapeCommas from './escapeCommas'
3
2
  import { withAlphaValue } from './withAlphaVariable'
4
3
  import {
@@ -21,37 +20,19 @@ import negateValue from './negateValue'
21
20
  import { backgroundSize } from './validateFormalSyntax'
22
21
  import { flagEnabled } from '../featureFlags.js'
23
22
 
23
+ /**
24
+ * @param {import('postcss-selector-parser').Container} selectors
25
+ * @param {(className: string) => string} updateClass
26
+ * @returns {string}
27
+ */
24
28
  export function updateAllClasses(selectors, updateClass) {
25
- let parser = selectorParser((selectors) => {
26
- selectors.walkClasses((sel) => {
27
- let updatedClass = updateClass(sel.value)
28
- sel.value = updatedClass
29
- if (sel.raws && sel.raws.value) {
30
- sel.raws.value = escapeCommas(sel.raws.value)
31
- }
32
- })
33
- })
34
-
35
- let result = parser.processSync(selectors)
29
+ selectors.walkClasses((sel) => {
30
+ sel.value = updateClass(sel.value)
36
31
 
37
- return result
38
- }
39
-
40
- export function filterSelectorsForClass(selectors, classCandidate) {
41
- let parser = selectorParser((selectors) => {
42
- selectors.each((sel) => {
43
- const containsClass = sel.nodes.some(
44
- (node) => node.type === 'class' && node.value === classCandidate
45
- )
46
- if (!containsClass) {
47
- sel.remove()
48
- }
49
- })
32
+ if (sel.raws && sel.raws.value) {
33
+ sel.raws.value = escapeCommas(sel.raws.value)
34
+ }
50
35
  })
51
-
52
- let result = parser.processSync(selectors)
53
-
54
- return result
55
36
  }
56
37
 
57
38
  function resolveArbitraryValue(modifier, validate) {
@@ -877,8 +877,8 @@ module.exports = {
877
877
  none: 'none',
878
878
  all: 'all',
879
879
  DEFAULT:
880
- 'color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter',
881
- colors: 'color, background-color, border-color, outline-color, text-decoration-color, fill, stroke',
880
+ 'color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter',
881
+ colors: 'color, background-color, border-color, text-decoration-color, fill, stroke',
882
882
  opacity: 'opacity',
883
883
  shadow: 'box-shadow',
884
884
  transform: 'transform',