tailwindcss 3.1.0 → 3.1.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/CHANGELOG.md +11 -1
- package/lib/lib/defaultExtractor.js +8 -8
- package/lib/lib/evaluateTailwindFunctions.js +1 -1
- package/lib/lib/resolveDefaultsAtRules.js +54 -40
- package/package.json +1 -1
- package/src/lib/defaultExtractor.js +7 -7
- package/src/lib/evaluateTailwindFunctions.js +1 -1
- package/src/lib/resolveDefaultsAtRules.js +53 -36
- package/types/index.d.ts +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
- Nothing yet!
|
|
11
11
|
|
|
12
|
+
## [3.1.1] - 2022-06-09
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fix candidate extractor regression ([#8558](https://github.com/tailwindlabs/tailwindcss/pull/8558))
|
|
17
|
+
- Split `::backdrop` into separate defaults group ([#8567](https://github.com/tailwindlabs/tailwindcss/pull/8567))
|
|
18
|
+
- Fix postcss plugin type ([#8564](https://github.com/tailwindlabs/tailwindcss/pull/8564))
|
|
19
|
+
- Fix class detection in markdown code fences and slim templates ([#8569](https://github.com/tailwindlabs/tailwindcss/pull/8569))
|
|
20
|
+
|
|
12
21
|
## [3.1.0] - 2022-06-08
|
|
13
22
|
|
|
14
23
|
### Fixed
|
|
@@ -1952,7 +1961,8 @@ No release notes
|
|
|
1952
1961
|
|
|
1953
1962
|
- Everything!
|
|
1954
1963
|
|
|
1955
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.
|
|
1964
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.1...HEAD
|
|
1965
|
+
[3.1.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.0...v3.1.1
|
|
1956
1966
|
[3.1.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.24...v3.1.0
|
|
1957
1967
|
[3.0.24]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.23...v3.0.24
|
|
1958
1968
|
[3.0.23]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.22...v3.0.23
|
|
@@ -62,7 +62,7 @@ function* buildRegExps(context) {
|
|
|
62
62
|
let variantGroupingEnabled = (0, _featureFlagsJs).flagEnabled(context.tailwindConfig, "variantGrouping");
|
|
63
63
|
let utility = regex.any([
|
|
64
64
|
// Arbitrary properties
|
|
65
|
-
/\[[^\s:'"]+:[^\s\]]+\]/,
|
|
65
|
+
/\[[^\s:'"`]+:[^\s\]]+\]/,
|
|
66
66
|
// Utilities
|
|
67
67
|
regex.pattern([
|
|
68
68
|
// Utility Name / Group Name
|
|
@@ -75,7 +75,7 @@ function* buildRegExps(context) {
|
|
|
75
75
|
// Not immediately followed by an `{[(`
|
|
76
76
|
/(?![{([]])/,
|
|
77
77
|
// optionally followed by an opacity modifier
|
|
78
|
-
/(?:\/[^\s'"
|
|
78
|
+
/(?:\/[^\s'"`\\><$]*)?/,
|
|
79
79
|
]),
|
|
80
80
|
regex.pattern([
|
|
81
81
|
// Arbitrary values
|
|
@@ -83,10 +83,10 @@ function* buildRegExps(context) {
|
|
|
83
83
|
// Not immediately followed by an `{[(`
|
|
84
84
|
/(?![{([]])/,
|
|
85
85
|
// optionally followed by an opacity modifier
|
|
86
|
-
/(?:\/[^\s'"
|
|
86
|
+
/(?:\/[^\s'"`\\$]*)?/,
|
|
87
87
|
]),
|
|
88
88
|
// Normal values w/o quotes — may include an opacity modifier
|
|
89
|
-
/[-\/][^\s'"
|
|
89
|
+
/[-\/][^\s'"`\\$={><]*/,
|
|
90
90
|
])),
|
|
91
91
|
]),
|
|
92
92
|
]);
|
|
@@ -95,11 +95,11 @@ function* buildRegExps(context) {
|
|
|
95
95
|
"((?=((",
|
|
96
96
|
regex.any([
|
|
97
97
|
regex.pattern([
|
|
98
|
-
/([^\s"'
|
|
98
|
+
/([^\s"'`\[\\]+-)?\[[^\s"'`\\]+\]/,
|
|
99
99
|
separator
|
|
100
100
|
]),
|
|
101
101
|
regex.pattern([
|
|
102
|
-
/[^\s"'
|
|
102
|
+
/[^\s"'`\[\\]+/,
|
|
103
103
|
separator
|
|
104
104
|
]),
|
|
105
105
|
], true),
|
|
@@ -121,8 +121,8 @@ function* buildRegExps(context) {
|
|
|
121
121
|
utility,
|
|
122
122
|
]) : utility,
|
|
123
123
|
]);
|
|
124
|
-
// 5. Inner matches
|
|
125
|
-
|
|
124
|
+
// 5. Inner matches
|
|
125
|
+
yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
|
|
126
126
|
}
|
|
127
127
|
// We want to capture any "special" characters
|
|
128
128
|
// AND the characters immediately following them (if there is one)
|
|
@@ -140,7 +140,7 @@ let nodeTypePropertyMap = {
|
|
|
140
140
|
function _default({ tailwindConfig: config }) {
|
|
141
141
|
let functions = {
|
|
142
142
|
theme: (node, path, ...defaultValue)=>{
|
|
143
|
-
let matches = path.match(/^([
|
|
143
|
+
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/);
|
|
144
144
|
let alpha = undefined;
|
|
145
145
|
if (matches) {
|
|
146
146
|
path = matches[1];
|
|
@@ -23,52 +23,66 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
23
23
|
variableNodeMap.get(variable).add(rule.parent);
|
|
24
24
|
rule.remove();
|
|
25
25
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
for (let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
if ((0, _featureFlags).flagEnabled(tailwindConfig, "optimizeUniversalDefaults")) {
|
|
27
|
+
for (let universal of universals){
|
|
28
|
+
/** @type {Map<string, Set<string>>} */ let selectorGroups = new Map();
|
|
29
|
+
var ref;
|
|
30
|
+
let rules = (ref = variableNodeMap.get(universal.params)) !== null && ref !== void 0 ? ref : [];
|
|
31
|
+
for (let rule of rules){
|
|
32
|
+
for (let selector of extractElementSelector(rule.selector)){
|
|
33
|
+
// If selector contains a vendor prefix after a pseudo element or class,
|
|
34
|
+
// we consider them separately because merging the declarations into
|
|
35
|
+
// a single rule will cause browsers that do not understand the
|
|
36
|
+
// vendor prefix to throw out the whole rule
|
|
37
|
+
let selectorGroupName = selector.includes(":-") || selector.includes("::-") ? selector : "__DEFAULT__";
|
|
38
|
+
var ref1;
|
|
39
|
+
let selectors = (ref1 = selectorGroups.get(selectorGroupName)) !== null && ref1 !== void 0 ? ref1 : new Set();
|
|
40
|
+
selectorGroups.set(selectorGroupName, selectors);
|
|
41
|
+
selectors.add(selector);
|
|
42
|
+
}
|
|
41
43
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
if ((0, _featureFlags).flagEnabled(tailwindConfig, "optimizeUniversalDefaults")) {
|
|
45
|
+
if (selectorGroups.size === 0) {
|
|
46
|
+
universal.remove();
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
for (let [, selectors] of selectorGroups){
|
|
50
|
+
let universalRule = _postcss.default.rule({
|
|
51
|
+
source: universal.source
|
|
52
|
+
});
|
|
53
|
+
universalRule.selectors = [
|
|
54
|
+
...selectors
|
|
55
|
+
];
|
|
56
|
+
universalRule.append(universal.nodes.map((node)=>node.clone()));
|
|
57
|
+
universal.before(universalRule);
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
universal.remove();
|
|
61
|
+
}
|
|
62
|
+
} else if (universals.size) {
|
|
63
|
+
let universalRule = _postcss.default.rule({
|
|
64
|
+
selectors: [
|
|
63
65
|
"*",
|
|
64
66
|
"::before",
|
|
65
|
-
"::after"
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
"::after"
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
for (let universal of universals){
|
|
68
71
|
universalRule.append(universal.nodes);
|
|
69
|
-
|
|
72
|
+
if (!universalRule.parent) {
|
|
73
|
+
universal.before(universalRule);
|
|
74
|
+
}
|
|
75
|
+
if (!universalRule.source) {
|
|
76
|
+
universalRule.source = universal.source;
|
|
77
|
+
}
|
|
78
|
+
universal.remove();
|
|
70
79
|
}
|
|
71
|
-
|
|
80
|
+
let backdropRule = universalRule.clone({
|
|
81
|
+
selectors: [
|
|
82
|
+
"::backdrop"
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
universalRule.after(backdropRule);
|
|
72
86
|
}
|
|
73
87
|
};
|
|
74
88
|
}
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ function* buildRegExps(context) {
|
|
|
25
25
|
|
|
26
26
|
let utility = regex.any([
|
|
27
27
|
// Arbitrary properties
|
|
28
|
-
/\[[^\s:'"]+:[^\s\]]+\]/,
|
|
28
|
+
/\[[^\s:'"`]+:[^\s\]]+\]/,
|
|
29
29
|
|
|
30
30
|
// Utilities
|
|
31
31
|
regex.pattern([
|
|
@@ -43,7 +43,7 @@ function* buildRegExps(context) {
|
|
|
43
43
|
/(?![{([]])/,
|
|
44
44
|
|
|
45
45
|
// optionally followed by an opacity modifier
|
|
46
|
-
/(?:\/[^\s'"
|
|
46
|
+
/(?:\/[^\s'"`\\><$]*)?/,
|
|
47
47
|
]),
|
|
48
48
|
|
|
49
49
|
regex.pattern([
|
|
@@ -54,11 +54,11 @@ function* buildRegExps(context) {
|
|
|
54
54
|
/(?![{([]])/,
|
|
55
55
|
|
|
56
56
|
// optionally followed by an opacity modifier
|
|
57
|
-
/(?:\/[^\s'"
|
|
57
|
+
/(?:\/[^\s'"`\\$]*)?/,
|
|
58
58
|
]),
|
|
59
59
|
|
|
60
60
|
// Normal values w/o quotes — may include an opacity modifier
|
|
61
|
-
/[-\/][^\s'"
|
|
61
|
+
/[-\/][^\s'"`\\$={><]*/,
|
|
62
62
|
])
|
|
63
63
|
),
|
|
64
64
|
]),
|
|
@@ -69,8 +69,8 @@ function* buildRegExps(context) {
|
|
|
69
69
|
'((?=((',
|
|
70
70
|
regex.any(
|
|
71
71
|
[
|
|
72
|
-
regex.pattern([/([^\s"'
|
|
73
|
-
regex.pattern([/[^\s"'
|
|
72
|
+
regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`\\]+\]/, separator]),
|
|
73
|
+
regex.pattern([/[^\s"'`\[\\]+/, separator]),
|
|
74
74
|
],
|
|
75
75
|
true
|
|
76
76
|
),
|
|
@@ -91,7 +91,7 @@ function* buildRegExps(context) {
|
|
|
91
91
|
])
|
|
92
92
|
|
|
93
93
|
// 5. Inner matches
|
|
94
|
-
|
|
94
|
+
yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// We want to capture any "special" characters
|
|
@@ -162,7 +162,7 @@ let nodeTypePropertyMap = {
|
|
|
162
162
|
export default function ({ tailwindConfig: config }) {
|
|
163
163
|
let functions = {
|
|
164
164
|
theme: (node, path, ...defaultValue) => {
|
|
165
|
-
let matches = path.match(/^([
|
|
165
|
+
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/)
|
|
166
166
|
let alpha = undefined
|
|
167
167
|
|
|
168
168
|
if (matches) {
|
|
@@ -91,56 +91,73 @@ export default function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
91
91
|
rule.remove()
|
|
92
92
|
})
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
if (flagEnabled(tailwindConfig, 'optimizeUniversalDefaults')) {
|
|
95
|
+
for (let universal of universals) {
|
|
96
|
+
/** @type {Map<string, Set<string>>} */
|
|
97
|
+
let selectorGroups = new Map()
|
|
98
|
+
|
|
99
|
+
let rules = variableNodeMap.get(universal.params) ?? []
|
|
100
|
+
|
|
101
|
+
for (let rule of rules) {
|
|
102
|
+
for (let selector of extractElementSelector(rule.selector)) {
|
|
103
|
+
// If selector contains a vendor prefix after a pseudo element or class,
|
|
104
|
+
// we consider them separately because merging the declarations into
|
|
105
|
+
// a single rule will cause browsers that do not understand the
|
|
106
|
+
// vendor prefix to throw out the whole rule
|
|
107
|
+
let selectorGroupName =
|
|
108
|
+
selector.includes(':-') || selector.includes('::-') ? selector : '__DEFAULT__'
|
|
109
|
+
|
|
110
|
+
let selectors = selectorGroups.get(selectorGroupName) ?? new Set()
|
|
111
|
+
selectorGroups.set(selectorGroupName, selectors)
|
|
112
|
+
|
|
113
|
+
selectors.add(selector)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
97
116
|
|
|
98
|
-
|
|
117
|
+
if (flagEnabled(tailwindConfig, 'optimizeUniversalDefaults')) {
|
|
118
|
+
if (selectorGroups.size === 0) {
|
|
119
|
+
universal.remove()
|
|
120
|
+
continue
|
|
121
|
+
}
|
|
99
122
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// a single rule will cause browsers that do not understand the
|
|
105
|
-
// vendor prefix to throw out the whole rule
|
|
106
|
-
let selectorGroupName =
|
|
107
|
-
selector.includes(':-') || selector.includes('::-') ? selector : '__DEFAULT__'
|
|
123
|
+
for (let [, selectors] of selectorGroups) {
|
|
124
|
+
let universalRule = postcss.rule({
|
|
125
|
+
source: universal.source,
|
|
126
|
+
})
|
|
108
127
|
|
|
109
|
-
|
|
110
|
-
selectorGroups.set(selectorGroupName, selectors)
|
|
128
|
+
universalRule.selectors = [...selectors]
|
|
111
129
|
|
|
112
|
-
|
|
130
|
+
universalRule.append(universal.nodes.map((node) => node.clone()))
|
|
131
|
+
universal.before(universalRule)
|
|
132
|
+
}
|
|
113
133
|
}
|
|
114
|
-
}
|
|
115
134
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
for (let [, selectors] of selectorGroups) {
|
|
123
|
-
let universalRule = postcss.rule({
|
|
124
|
-
source: universal.source,
|
|
125
|
-
})
|
|
135
|
+
universal.remove()
|
|
136
|
+
}
|
|
137
|
+
} else if (universals.size) {
|
|
138
|
+
let universalRule = postcss.rule({
|
|
139
|
+
selectors: ['*', '::before', '::after'],
|
|
140
|
+
})
|
|
126
141
|
|
|
127
|
-
|
|
142
|
+
for (let universal of universals) {
|
|
143
|
+
universalRule.append(universal.nodes)
|
|
128
144
|
|
|
129
|
-
|
|
145
|
+
if (!universalRule.parent) {
|
|
130
146
|
universal.before(universalRule)
|
|
131
147
|
}
|
|
132
|
-
} else {
|
|
133
|
-
let universalRule = postcss.rule({
|
|
134
|
-
source: universal.source,
|
|
135
|
-
})
|
|
136
148
|
|
|
137
|
-
universalRule.
|
|
149
|
+
if (!universalRule.source) {
|
|
150
|
+
universalRule.source = universal.source
|
|
151
|
+
}
|
|
138
152
|
|
|
139
|
-
|
|
140
|
-
universal.before(universalRule)
|
|
153
|
+
universal.remove()
|
|
141
154
|
}
|
|
142
155
|
|
|
143
|
-
|
|
156
|
+
let backdropRule = universalRule.clone({
|
|
157
|
+
selectors: ['::backdrop'],
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
universalRule.after(backdropRule)
|
|
144
161
|
}
|
|
145
162
|
}
|
|
146
163
|
}
|
package/types/index.d.ts
CHANGED