tailwindcss 3.2.5 → 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 +16 -1
- package/lib/lib/expandTailwindAtRules.js +1 -2
- package/lib/lib/generateRules.js +6 -6
- package/lib/util/formatVariantSelector.js +2 -12
- package/lib/util/pluginUtils.js +5 -24
- package/package.json +1 -3
- package/src/lib/expandTailwindAtRules.js +1 -3
- package/src/lib/generateRules.js +20 -10
- package/src/util/formatVariantSelector.js +1 -1
- package/src/util/pluginUtils.js +10 -29
- package/stubs/defaultConfig.stub.js +2 -2
- package/oxide-node-api-shim/index.js +0 -21
- package/oxide-node-api-shim/package.json +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,19 @@ 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
|
+
|
|
19
|
+
## [3.2.6] - 2023-02-08
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- drop oxide api shim ([add16364b4b1100e1af23ad1ca6900a0b53cbba0](https://github.com/tailwindlabs/tailwindcss/commit/add16364b4b1100e1af23ad1ca6900a0b53cbba0))
|
|
24
|
+
|
|
12
25
|
## [3.2.5] - 2023-02-08
|
|
13
26
|
|
|
14
27
|
### Added
|
|
@@ -2163,7 +2176,9 @@ No release notes
|
|
|
2163
2176
|
|
|
2164
2177
|
- Everything!
|
|
2165
2178
|
|
|
2166
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.
|
|
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
|
|
2181
|
+
[3.2.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.5...v3.2.6
|
|
2167
2182
|
[3.2.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.4...v3.2.5
|
|
2168
2183
|
[3.2.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.3...v3.2.4
|
|
2169
2184
|
[3.2.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.2...v3.2.3
|
|
@@ -13,7 +13,6 @@ const _generateRules = require("./generateRules");
|
|
|
13
13
|
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
|
14
14
|
const _cloneNodes = /*#__PURE__*/ _interopRequireDefault(require("../util/cloneNodes"));
|
|
15
15
|
const _defaultExtractor = require("./defaultExtractor");
|
|
16
|
-
const _oxide = /*#__PURE__*/ _interopRequireDefault(require("@tailwindcss/oxide"));
|
|
17
16
|
function _interopRequireDefault(obj) {
|
|
18
17
|
return obj && obj.__esModule ? obj : {
|
|
19
18
|
default: obj
|
|
@@ -155,7 +154,7 @@ function expandTailwindAtRules(context) {
|
|
|
155
154
|
env.DEBUG && console.time("Reading changed files");
|
|
156
155
|
if (env.OXIDE) {
|
|
157
156
|
// TODO: Pass through or implement `extractor`
|
|
158
|
-
for (let candidate of
|
|
157
|
+
for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
|
|
159
158
|
candidates.add(candidate);
|
|
160
159
|
}
|
|
161
160
|
// for (let { file, content, extension } of context.changedContent) {
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -162,12 +162,12 @@ function applyImportant(matches, classCandidate) {
|
|
|
162
162
|
]
|
|
163
163
|
});
|
|
164
164
|
container.walkRules((r)=>{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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) {
|
package/lib/util/pluginUtils.js
CHANGED
|
@@ -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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
sel.value =
|
|
39
|
-
|
|
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.
|
|
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",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"stubs/*.stub.js",
|
|
42
42
|
"nesting/*",
|
|
43
43
|
"types/**/*",
|
|
44
|
-
"oxide-node-api-shim",
|
|
45
44
|
"*.d.ts",
|
|
46
45
|
"*.css",
|
|
47
46
|
"*.js"
|
|
@@ -71,7 +70,6 @@
|
|
|
71
70
|
"postcss": "^8.0.9"
|
|
72
71
|
},
|
|
73
72
|
"dependencies": {
|
|
74
|
-
"@tailwindcss/oxide": "file:./oxide-node-api-shim",
|
|
75
73
|
"arg": "^5.0.2",
|
|
76
74
|
"chokidar": "^3.5.3",
|
|
77
75
|
"color-name": "^1.1.4",
|
|
@@ -6,8 +6,6 @@ import log from '../util/log'
|
|
|
6
6
|
import cloneNodes from '../util/cloneNodes'
|
|
7
7
|
import { defaultExtractor } from './defaultExtractor'
|
|
8
8
|
|
|
9
|
-
import oxide from '@tailwindcss/oxide'
|
|
10
|
-
|
|
11
9
|
let env = sharedState.env
|
|
12
10
|
|
|
13
11
|
const builtInExtractors = {
|
|
@@ -134,7 +132,7 @@ export default function expandTailwindAtRules(context) {
|
|
|
134
132
|
|
|
135
133
|
if (env.OXIDE) {
|
|
136
134
|
// TODO: Pass through or implement `extractor`
|
|
137
|
-
for (let candidate of oxide.parseCandidateStringsFromFiles(
|
|
135
|
+
for (let candidate of require('@tailwindcss/oxide').parseCandidateStringsFromFiles(
|
|
138
136
|
context.changedContent
|
|
139
137
|
// Object.assign({}, builtInTransformers, context.tailwindConfig.content.transform)
|
|
140
138
|
)) {
|
package/src/lib/generateRules.js
CHANGED
|
@@ -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,
|
|
6
|
+
import { updateAllClasses, getMatchingTypes } from '../util/pluginUtils'
|
|
7
7
|
import log from '../util/log'
|
|
8
8
|
import * as sharedState from './sharedState'
|
|
9
|
-
import {
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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) => {
|
package/src/util/pluginUtils.js
CHANGED
|
@@ -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
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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,
|
|
881
|
-
colors: 'color, background-color, border-color,
|
|
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',
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
let log = require('../lib/util/log').default
|
|
2
|
-
|
|
3
|
-
// This should be a temporary file.
|
|
4
|
-
//
|
|
5
|
-
// Right now we require `@tailwindcss/oxide` as one of the packages in package.json. This contains
|
|
6
|
-
// all the necessary Rust bindings. However, we won't ship those bindings by default yet, and
|
|
7
|
-
// therefore you need to install the explicit oxide-insiders version where the Rust bindings are
|
|
8
|
-
// available.
|
|
9
|
-
//
|
|
10
|
-
// To ensure that this doesn't break existing builds of the insiders release, we will use this shim
|
|
11
|
-
// to implement all the APIs and show a warning in case you are trying to run `OXIDE=1 npx
|
|
12
|
-
// tailwindcs ...` without having installed the oxide-insiders version.
|
|
13
|
-
module.exports.parseCandidateStringsFromFiles = function parseCandidateStringsFromFiles(
|
|
14
|
-
_changedContent
|
|
15
|
-
) {
|
|
16
|
-
log.warn('oxide-required', [
|
|
17
|
-
'It looks like you are trying to run Tailwind CSS with the OXIDE=1 environment variable.',
|
|
18
|
-
'This version does not have the necessary Rust bindings, so please install the `tailwindcss@insiders-oxide` version instead.',
|
|
19
|
-
])
|
|
20
|
-
return []
|
|
21
|
-
}
|