tailwindcss 3.3.2 → 3.3.3
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 +26 -1
- package/lib/cli/build/plugin.js +2 -2
- package/lib/corePlugins.js +11 -7
- package/lib/css/preflight.css +9 -0
- package/lib/lib/evaluateTailwindFunctions.js +5 -3
- package/lib/lib/expandTailwindAtRules.js +4 -4
- package/lib/lib/generateRules.js +15 -7
- package/lib/lib/setupContextUtils.js +24 -6
- package/lib/lib/setupTrackingContext.js +2 -1
- package/lib/plugin.js +3 -3
- package/lib/processTailwindFeatures.js +2 -2
- package/lib/util/dataTypes.js +14 -6
- package/lib/util/formatVariantSelector.js +2 -2
- package/lib/util/prefixSelector.js +1 -1
- package/lib/util/pseudoElements.js +18 -34
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/package.json +1 -2
- package/src/cli/build/plugin.js +2 -2
- package/src/corePlugins.js +13 -7
- package/src/css/preflight.css +9 -0
- package/src/lib/evaluateTailwindFunctions.js +4 -1
- package/src/lib/expandTailwindAtRules.js +9 -7
- package/src/lib/generateRules.js +15 -8
- package/src/lib/setupContextUtils.js +18 -5
- package/src/lib/setupTrackingContext.js +1 -3
- package/src/plugin.js +3 -3
- package/src/processTailwindFeatures.js +3 -2
- package/src/util/dataTypes.js +17 -6
- package/src/util/formatVariantSelector.js +2 -2
- package/src/util/prefixSelector.js +1 -0
- package/src/util/pseudoElements.js +14 -17
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/config.full.js +1 -0
- package/types/generated/default-theme.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
- Nothing yet!
|
|
11
11
|
|
|
12
|
+
## [3.3.3] - 2023-07-13
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fix issue where some pseudo-element variants generated the wrong selector ([#10943](https://github.com/tailwindlabs/tailwindcss/pull/10943), [#10962](https://github.com/tailwindlabs/tailwindcss/pull/10962), [#11111](https://github.com/tailwindlabs/tailwindcss/pull/11111))
|
|
17
|
+
- Make font settings propagate into buttons, inputs, etc. ([#10940](https://github.com/tailwindlabs/tailwindcss/pull/10940))
|
|
18
|
+
- Fix parsing of `theme()` inside `calc()` when there are no spaces around operators ([#11157](https://github.com/tailwindlabs/tailwindcss/pull/11157))
|
|
19
|
+
- Ensure `repeating-conic-gradient` is detected as an image ([#11180](https://github.com/tailwindlabs/tailwindcss/pull/11180))
|
|
20
|
+
- Move unknown pseudo-elements outside of `:is` by default ([#11345](https://github.com/tailwindlabs/tailwindcss/pull/11345))
|
|
21
|
+
- Escape animation names when prefixes contain special characters ([#11470](https://github.com/tailwindlabs/tailwindcss/pull/11470))
|
|
22
|
+
- Don't prefix arbitrary classes in `group` and `peer` variants ([#11454](https://github.com/tailwindlabs/tailwindcss/pull/11454))
|
|
23
|
+
- Sort classes using position of first matching rule ([#11504](https://github.com/tailwindlabs/tailwindcss/pull/11504))
|
|
24
|
+
- Allow variant to be an at-rule without a prelude ([#11589](https://github.com/tailwindlabs/tailwindcss/pull/11589))
|
|
25
|
+
- Make PostCSS plugin async to improve performance ([#11548](https://github.com/tailwindlabs/tailwindcss/pull/11548))
|
|
26
|
+
- Don’t error when a config file is missing ([f97759f](https://github.com/tailwindlabs/tailwindcss/commit/f97759f808d15ace66647b1405744fcf95a392e5))
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Add `aria-busy` utility ([#10966](https://github.com/tailwindlabs/tailwindcss/pull/10966))
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Reset padding for `<dialog>` elements in preflight ([#11069](https://github.com/tailwindlabs/tailwindcss/pull/11069))
|
|
35
|
+
|
|
12
36
|
## [3.3.2] - 2023-04-25
|
|
13
37
|
|
|
14
38
|
### Fixed
|
|
@@ -2236,7 +2260,8 @@ No release notes
|
|
|
2236
2260
|
|
|
2237
2261
|
- Everything!
|
|
2238
2262
|
|
|
2239
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.3.
|
|
2263
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.3.3...HEAD
|
|
2264
|
+
[3.3.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.3.2...v3.3.3
|
|
2240
2265
|
[3.3.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.3.1...v3.3.2
|
|
2241
2266
|
[3.3.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.3.0...v3.3.1
|
|
2242
2267
|
[3.3.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.7...v3.3.0
|
package/lib/cli/build/plugin.js
CHANGED
|
@@ -245,9 +245,9 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
245
245
|
let tailwindPlugin = ()=>{
|
|
246
246
|
return {
|
|
247
247
|
postcssPlugin: "tailwindcss",
|
|
248
|
-
Once (root, { result }) {
|
|
248
|
+
async Once (root, { result }) {
|
|
249
249
|
_sharedState.env.DEBUG && console.time("Compiling CSS");
|
|
250
|
-
(0, _processTailwindFeatures.default)(({ createContext })=>{
|
|
250
|
+
await (0, _processTailwindFeatures.default)(({ createContext })=>{
|
|
251
251
|
console.error();
|
|
252
252
|
console.error("Rebuilding...");
|
|
253
253
|
return ()=>{
|
package/lib/corePlugins.js
CHANGED
|
@@ -35,6 +35,7 @@ const _parseBoxShadowValue = require("./util/parseBoxShadowValue");
|
|
|
35
35
|
const _removeAlphaVariables = require("./util/removeAlphaVariables");
|
|
36
36
|
const _featureFlags = require("./featureFlags");
|
|
37
37
|
const _dataTypes = require("./util/dataTypes");
|
|
38
|
+
const _setupContextUtils = require("./lib/setupContextUtils");
|
|
38
39
|
function _interop_require_default(obj) {
|
|
39
40
|
return obj && obj.__esModule ? obj : {
|
|
40
41
|
default: obj
|
|
@@ -135,7 +136,7 @@ let variantPlugins = {
|
|
|
135
136
|
return "&::after";
|
|
136
137
|
});
|
|
137
138
|
},
|
|
138
|
-
pseudoClassVariants: ({ addVariant , matchVariant , config })=>{
|
|
139
|
+
pseudoClassVariants: ({ addVariant , matchVariant , config , prefix })=>{
|
|
139
140
|
let pseudoVariants = [
|
|
140
141
|
// Positional
|
|
141
142
|
[
|
|
@@ -216,17 +217,17 @@ let variantPlugins = {
|
|
|
216
217
|
}
|
|
217
218
|
let variants = {
|
|
218
219
|
group: (_, { modifier })=>modifier ? [
|
|
219
|
-
`:merge(.group\\/${(0, _escapeClassName.default)(modifier)})`,
|
|
220
|
+
`:merge(${prefix(".group")}\\/${(0, _escapeClassName.default)(modifier)})`,
|
|
220
221
|
" &"
|
|
221
222
|
] : [
|
|
222
|
-
`:merge(.group)`,
|
|
223
|
+
`:merge(${prefix(".group")})`,
|
|
223
224
|
" &"
|
|
224
225
|
],
|
|
225
226
|
peer: (_, { modifier })=>modifier ? [
|
|
226
|
-
`:merge(.peer\\/${(0, _escapeClassName.default)(modifier)})`,
|
|
227
|
+
`:merge(${prefix(".peer")}\\/${(0, _escapeClassName.default)(modifier)})`,
|
|
227
228
|
" ~ &"
|
|
228
229
|
] : [
|
|
229
|
-
`:merge(.peer)`,
|
|
230
|
+
`:merge(${prefix(".peer")})`,
|
|
230
231
|
" ~ &"
|
|
231
232
|
]
|
|
232
233
|
};
|
|
@@ -255,7 +256,10 @@ let variantPlugins = {
|
|
|
255
256
|
// result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
|
|
256
257
|
return result.slice(0, start) + a + result.slice(start + 1, end) + b + result.slice(end);
|
|
257
258
|
}, {
|
|
258
|
-
values: Object.fromEntries(pseudoVariants)
|
|
259
|
+
values: Object.fromEntries(pseudoVariants),
|
|
260
|
+
[_setupContextUtils.INTERNAL_FEATURES]: {
|
|
261
|
+
respectPrefix: false
|
|
262
|
+
}
|
|
259
263
|
});
|
|
260
264
|
}
|
|
261
265
|
},
|
|
@@ -1283,7 +1287,7 @@ let corePlugins = {
|
|
|
1283
1287
|
});
|
|
1284
1288
|
},
|
|
1285
1289
|
animation: ({ matchUtilities , theme , config })=>{
|
|
1286
|
-
let prefixName = (name)
|
|
1290
|
+
let prefixName = (name)=>(0, _escapeClassName.default)(config("prefix") + name);
|
|
1287
1291
|
var _theme;
|
|
1288
1292
|
let keyframes = Object.fromEntries(Object.entries((_theme = theme("keyframes")) !== null && _theme !== void 0 ? _theme : {}).map(([key, value])=>{
|
|
1289
1293
|
return [
|
package/lib/css/preflight.css
CHANGED
|
@@ -163,6 +163,8 @@ optgroup,
|
|
|
163
163
|
select,
|
|
164
164
|
textarea {
|
|
165
165
|
font-family: inherit; /* 1 */
|
|
166
|
+
font-feature-settings: inherit; /* 1 */
|
|
167
|
+
font-variation-settings: inherit; /* 1 */
|
|
166
168
|
font-size: 100%; /* 1 */
|
|
167
169
|
font-weight: inherit; /* 1 */
|
|
168
170
|
line-height: inherit; /* 1 */
|
|
@@ -300,6 +302,13 @@ menu {
|
|
|
300
302
|
padding: 0;
|
|
301
303
|
}
|
|
302
304
|
|
|
305
|
+
/*
|
|
306
|
+
Reset default styling for dialogs.
|
|
307
|
+
*/
|
|
308
|
+
dialog {
|
|
309
|
+
padding: 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
303
312
|
/*
|
|
304
313
|
Prevent resizing textareas horizontally by default.
|
|
305
314
|
*/
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
|
|
12
12
|
const _didyoumean = /*#__PURE__*/ _interop_require_default(require("didyoumean"));
|
|
13
13
|
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
|
|
14
|
-
const
|
|
14
|
+
const _index = /*#__PURE__*/ _interop_require_default(require("../value-parser/index"));
|
|
15
15
|
const _normalizeScreens = require("../util/normalizeScreens");
|
|
16
16
|
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
|
|
17
17
|
const _toPath = require("../util/toPath");
|
|
@@ -121,7 +121,7 @@ function extractArgs(node, vNodes, functions) {
|
|
|
121
121
|
if (vNode.type === "div" && vNode.value === ",") {
|
|
122
122
|
args.push("");
|
|
123
123
|
} else {
|
|
124
|
-
args[args.length - 1] +=
|
|
124
|
+
args[args.length - 1] += _index.default.stringify(vNode);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
return args;
|
|
@@ -135,7 +135,9 @@ function resolveVNode(node, vNode, functions) {
|
|
|
135
135
|
return vNode;
|
|
136
136
|
}
|
|
137
137
|
function resolveFunctions(node, input, functions) {
|
|
138
|
-
|
|
138
|
+
let hasAnyFn = Object.keys(functions).some((fn)=>input.includes(`${fn}(`));
|
|
139
|
+
if (!hasAnyFn) return input;
|
|
140
|
+
return (0, _index.default)(input).walk((vNode)=>{
|
|
139
141
|
resolveVNode(node, vNode, functions);
|
|
140
142
|
}).toString();
|
|
141
143
|
}
|
|
@@ -124,7 +124,7 @@ function getClassCandidates(content, extractor, candidates, seen) {
|
|
|
124
124
|
return returnValue;
|
|
125
125
|
}
|
|
126
126
|
function expandTailwindAtRules(context) {
|
|
127
|
-
return (root)=>{
|
|
127
|
+
return async (root)=>{
|
|
128
128
|
let layerNodes = {
|
|
129
129
|
base: null,
|
|
130
130
|
components: null,
|
|
@@ -165,12 +165,12 @@ function expandTailwindAtRules(context) {
|
|
|
165
165
|
// getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
|
|
166
166
|
// }
|
|
167
167
|
} else {
|
|
168
|
-
|
|
168
|
+
await Promise.all(context.changedContent.map(async ({ file , content , extension })=>{
|
|
169
169
|
let transformer = getTransformer(context.tailwindConfig, extension);
|
|
170
170
|
let extractor = getExtractor(context, extension);
|
|
171
|
-
content = file ? _fs.default.
|
|
171
|
+
content = file ? await _fs.default.promises.readFile(file, "utf8") : content;
|
|
172
172
|
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
173
|
-
}
|
|
173
|
+
}));
|
|
174
174
|
}
|
|
175
175
|
env.DEBUG && console.timeEnd("Reading changed files");
|
|
176
176
|
// ---
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -231,12 +231,12 @@ function applyVariant(variant, matches, context) {
|
|
|
231
231
|
// group[:hover] (`-` is missing)
|
|
232
232
|
let match = /(.)(-?)\[(.*)\]/g.exec(variant);
|
|
233
233
|
if (match) {
|
|
234
|
-
let [, char,
|
|
234
|
+
let [, char, separator, value] = match;
|
|
235
235
|
// @-[200px] case
|
|
236
|
-
if (char === "@" &&
|
|
236
|
+
if (char === "@" && separator === "-") return [];
|
|
237
237
|
// group[:hover] case
|
|
238
|
-
if (char !== "@" &&
|
|
239
|
-
variant = variant.replace(`${
|
|
238
|
+
if (char !== "@" && separator === "") return [];
|
|
239
|
+
variant = variant.replace(`${separator}[${value}]`, "");
|
|
240
240
|
args.value = value;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -259,9 +259,17 @@ function applyVariant(variant, matches, context) {
|
|
|
259
259
|
context.variantMap.set(variant, records);
|
|
260
260
|
}
|
|
261
261
|
if (context.variantMap.has(variant)) {
|
|
262
|
+
var _context_variantOptions_get;
|
|
262
263
|
let isArbitraryVariant = isArbitraryValue(variant);
|
|
264
|
+
var _context_variantOptions_get_INTERNAL_FEATURES;
|
|
265
|
+
let internalFeatures = (_context_variantOptions_get_INTERNAL_FEATURES = (_context_variantOptions_get = context.variantOptions.get(variant)) === null || _context_variantOptions_get === void 0 ? void 0 : _context_variantOptions_get[_setupContextUtils.INTERNAL_FEATURES]) !== null && _context_variantOptions_get_INTERNAL_FEATURES !== void 0 ? _context_variantOptions_get_INTERNAL_FEATURES : {};
|
|
263
266
|
let variantFunctionTuples = context.variantMap.get(variant).slice();
|
|
264
267
|
let result = [];
|
|
268
|
+
let respectPrefix = (()=>{
|
|
269
|
+
if (isArbitraryVariant) return false;
|
|
270
|
+
if (internalFeatures.respectPrefix === false) return false;
|
|
271
|
+
return true;
|
|
272
|
+
})();
|
|
265
273
|
for (let [meta, rule] of matches){
|
|
266
274
|
// Don't generate variants for user css
|
|
267
275
|
if (meta.layer === "user") {
|
|
@@ -318,7 +326,7 @@ function applyVariant(variant, matches, context) {
|
|
|
318
326
|
format (selectorFormat) {
|
|
319
327
|
collectedFormats.push({
|
|
320
328
|
format: selectorFormat,
|
|
321
|
-
|
|
329
|
+
respectPrefix
|
|
322
330
|
});
|
|
323
331
|
},
|
|
324
332
|
args
|
|
@@ -344,7 +352,7 @@ function applyVariant(variant, matches, context) {
|
|
|
344
352
|
if (typeof ruleWithVariant === "string") {
|
|
345
353
|
collectedFormats.push({
|
|
346
354
|
format: ruleWithVariant,
|
|
347
|
-
|
|
355
|
+
respectPrefix
|
|
348
356
|
});
|
|
349
357
|
}
|
|
350
358
|
if (ruleWithVariant === null) {
|
|
@@ -383,7 +391,7 @@ function applyVariant(variant, matches, context) {
|
|
|
383
391
|
// format: .foo &
|
|
384
392
|
collectedFormats.push({
|
|
385
393
|
format: modified.replace(rebuiltBase, "&"),
|
|
386
|
-
|
|
394
|
+
respectPrefix
|
|
387
395
|
});
|
|
388
396
|
rule.selector = before;
|
|
389
397
|
});
|
|
@@ -9,6 +9,9 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
INTERNAL_FEATURES: function() {
|
|
13
|
+
return INTERNAL_FEATURES;
|
|
14
|
+
},
|
|
12
15
|
isValidVariantFormatString: function() {
|
|
13
16
|
return isValidVariantFormatString;
|
|
14
17
|
},
|
|
@@ -92,6 +95,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
92
95
|
}
|
|
93
96
|
return newObj;
|
|
94
97
|
}
|
|
98
|
+
const INTERNAL_FEATURES = Symbol();
|
|
95
99
|
const VARIANT_TYPES = {
|
|
96
100
|
AddVariant: Symbol.for("ADD_VARIANT"),
|
|
97
101
|
MatchVariant: Symbol.for("MATCH_VARIANT")
|
|
@@ -270,11 +274,14 @@ function parseVariant(variant) {
|
|
|
270
274
|
if (!str.startsWith("@")) {
|
|
271
275
|
return ({ format })=>format(str);
|
|
272
276
|
}
|
|
273
|
-
let [, name, params] = /@(
|
|
274
|
-
|
|
277
|
+
let [, name, params] = /@(\S*)( .+|[({].*)?/g.exec(str);
|
|
278
|
+
var _params_trim;
|
|
279
|
+
return ({ wrap })=>{
|
|
280
|
+
return wrap(_postcss.default.atRule({
|
|
275
281
|
name,
|
|
276
|
-
params: params.trim()
|
|
282
|
+
params: (_params_trim = params === null || params === void 0 ? void 0 : params.trim()) !== null && _params_trim !== void 0 ? _params_trim : ""
|
|
277
283
|
}));
|
|
284
|
+
};
|
|
278
285
|
}).reverse();
|
|
279
286
|
return (api)=>{
|
|
280
287
|
for (let fn of fns){
|
|
@@ -924,7 +931,11 @@ function registerPlugins(plugins, context) {
|
|
|
924
931
|
rules = context.offsets.sort(rules);
|
|
925
932
|
let idx = BigInt(parasiteUtilities.length);
|
|
926
933
|
for (const [, rule] of rules){
|
|
927
|
-
|
|
934
|
+
let candidate = rule.raws.tailwind.candidate;
|
|
935
|
+
var _sortedClassNames_get;
|
|
936
|
+
// When multiple rules match a candidate
|
|
937
|
+
// always take the position of the first one
|
|
938
|
+
sortedClassNames.set(candidate, (_sortedClassNames_get = sortedClassNames.get(candidate)) !== null && _sortedClassNames_get !== void 0 ? _sortedClassNames_get : idx++);
|
|
928
939
|
}
|
|
929
940
|
return classes.map((className)=>{
|
|
930
941
|
var _sortedClassNames_get;
|
|
@@ -1095,13 +1106,20 @@ function registerPlugins(plugins, context) {
|
|
|
1095
1106
|
}
|
|
1096
1107
|
var _options_values1;
|
|
1097
1108
|
let isArbitraryVariant = !(value in ((_options_values1 = options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {}));
|
|
1109
|
+
var _options_INTERNAL_FEATURES;
|
|
1110
|
+
let internalFeatures = (_options_INTERNAL_FEATURES = options[INTERNAL_FEATURES]) !== null && _options_INTERNAL_FEATURES !== void 0 ? _options_INTERNAL_FEATURES : {};
|
|
1111
|
+
let respectPrefix = (()=>{
|
|
1112
|
+
if (isArbitraryVariant) return false;
|
|
1113
|
+
if (internalFeatures.respectPrefix === false) return false;
|
|
1114
|
+
return true;
|
|
1115
|
+
})();
|
|
1098
1116
|
formatStrings = formatStrings.map((format)=>format.map((str)=>({
|
|
1099
1117
|
format: str,
|
|
1100
|
-
|
|
1118
|
+
respectPrefix
|
|
1101
1119
|
})));
|
|
1102
1120
|
manualFormatStrings = manualFormatStrings.map((format)=>({
|
|
1103
1121
|
format,
|
|
1104
|
-
|
|
1122
|
+
respectPrefix
|
|
1105
1123
|
}));
|
|
1106
1124
|
let opts = {
|
|
1107
1125
|
candidate,
|
|
@@ -83,8 +83,9 @@ function getTailwindConfig(configOrPath) {
|
|
|
83
83
|
newDeps
|
|
84
84
|
];
|
|
85
85
|
}
|
|
86
|
+
var _configOrPath_config, _ref;
|
|
86
87
|
// It's a plain object, not a path
|
|
87
|
-
let newConfig = (0, _resolveconfig.default)(configOrPath
|
|
88
|
+
let newConfig = (0, _resolveconfig.default)((_ref = (_configOrPath_config = configOrPath === null || configOrPath === void 0 ? void 0 : configOrPath.config) !== null && _configOrPath_config !== void 0 ? _configOrPath_config : configOrPath) !== null && _ref !== void 0 ? _ref : {});
|
|
88
89
|
newConfig = (0, _validateConfig.validateConfig)(newConfig);
|
|
89
90
|
return [
|
|
90
91
|
newConfig,
|
package/lib/plugin.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
20
20
|
console.time("JIT TOTAL");
|
|
21
21
|
return root;
|
|
22
22
|
},
|
|
23
|
-
function(root, result) {
|
|
23
|
+
async function(root, result) {
|
|
24
24
|
var _findAtConfigPath1;
|
|
25
25
|
// Use the path for the `@config` directive if it exists, otherwise use the
|
|
26
26
|
// path for the file being processed
|
|
@@ -30,12 +30,12 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
30
30
|
let roots = root.nodes.filter((node)=>node.type === "root");
|
|
31
31
|
for (const root of roots){
|
|
32
32
|
if (root.type === "root") {
|
|
33
|
-
(0, _processTailwindFeatures.default)(context)(root, result);
|
|
33
|
+
await (0, _processTailwindFeatures.default)(context)(root, result);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
(0, _processTailwindFeatures.default)(context)(root, result);
|
|
38
|
+
await (0, _processTailwindFeatures.default)(context)(root, result);
|
|
39
39
|
},
|
|
40
40
|
false && function lightningCssPlugin(_root, result) {
|
|
41
41
|
let postcss = require("postcss");
|
|
@@ -26,7 +26,7 @@ function _interop_require_default(obj) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
function processTailwindFeatures(setupContext) {
|
|
29
|
-
return function(root, result) {
|
|
29
|
+
return async function(root, result) {
|
|
30
30
|
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root);
|
|
31
31
|
(0, _detectNesting.default)()(root, result);
|
|
32
32
|
// Partition apply rules that are found in the css
|
|
@@ -50,7 +50,7 @@ function processTailwindFeatures(setupContext) {
|
|
|
50
50
|
throw new Error("The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead.");
|
|
51
51
|
}
|
|
52
52
|
(0, _featureFlags.issueFlagNotices)(context.tailwindConfig);
|
|
53
|
-
(0, _expandTailwindAtRules.default)(context)(root, result);
|
|
53
|
+
await (0, _expandTailwindAtRules.default)(context)(root, result);
|
|
54
54
|
// Partition apply rules that are generated by
|
|
55
55
|
// addComponents, addUtilities and so on.
|
|
56
56
|
(0, _partitionApplyAtRules.default)()(root, result);
|
package/lib/util/dataTypes.js
CHANGED
|
@@ -89,16 +89,23 @@ function normalize(value, isRoot = true) {
|
|
|
89
89
|
if (isRoot) {
|
|
90
90
|
value = value.trim();
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
value = normalizeMathOperatorSpacing(value);
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Add spaces around operators inside math functions
|
|
97
|
+
* like calc() that do not follow an operator or '('.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} value
|
|
100
|
+
* @returns {string}
|
|
101
|
+
*/ function normalizeMathOperatorSpacing(value) {
|
|
102
|
+
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
|
|
95
103
|
let vars = [];
|
|
96
104
|
return match.replace(/var\((--.+?)[,)]/g, (match, g1)=>{
|
|
97
105
|
vars.push(g1);
|
|
98
106
|
return match.replace(g1, placeholder);
|
|
99
107
|
}).replace(/(-?\d*\.?\d(?!\b-\d.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ").replace(placeholderRe, ()=>vars.shift());
|
|
100
108
|
});
|
|
101
|
-
return value;
|
|
102
109
|
}
|
|
103
110
|
function url(value) {
|
|
104
111
|
return value.startsWith("url(");
|
|
@@ -199,11 +206,12 @@ function image(value) {
|
|
|
199
206
|
return images > 0;
|
|
200
207
|
}
|
|
201
208
|
let gradientTypes = new Set([
|
|
209
|
+
"conic-gradient",
|
|
202
210
|
"linear-gradient",
|
|
203
211
|
"radial-gradient",
|
|
212
|
+
"repeating-conic-gradient",
|
|
204
213
|
"repeating-linear-gradient",
|
|
205
|
-
"repeating-radial-gradient"
|
|
206
|
-
"conic-gradient"
|
|
214
|
+
"repeating-radial-gradient"
|
|
207
215
|
]);
|
|
208
216
|
function gradient(value) {
|
|
209
217
|
value = normalize(value);
|
|
@@ -32,7 +32,7 @@ function _interop_require_default(obj) {
|
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
/** @typedef {import('postcss-selector-parser').Root} Root */ /** @typedef {import('postcss-selector-parser').Selector} Selector */ /** @typedef {import('postcss-selector-parser').Pseudo} Pseudo */ /** @typedef {import('postcss-selector-parser').Node} Node */ /** @typedef {{format: string,
|
|
35
|
+
/** @typedef {import('postcss-selector-parser').Root} Root */ /** @typedef {import('postcss-selector-parser').Selector} Selector */ /** @typedef {import('postcss-selector-parser').Pseudo} Pseudo */ /** @typedef {import('postcss-selector-parser').Node} Node */ /** @typedef {{format: string, respectPrefix: boolean}[]} RawFormats */ /** @typedef {import('postcss-selector-parser').Root} ParsedFormats */ /** @typedef {RawFormats | ParsedFormats} AcceptedFormats */ let MERGE = ":merge";
|
|
36
36
|
function formatVariantSelector(formats, { context , candidate }) {
|
|
37
37
|
var _context_tailwindConfig_prefix;
|
|
38
38
|
let prefix = (_context_tailwindConfig_prefix = context === null || context === void 0 ? void 0 : context.tailwindConfig.prefix) !== null && _context_tailwindConfig_prefix !== void 0 ? _context_tailwindConfig_prefix : "";
|
|
@@ -41,7 +41,7 @@ function formatVariantSelector(formats, { context , candidate }) {
|
|
|
41
41
|
let ast = (0, _postcssselectorparser.default)().astSync(format.format);
|
|
42
42
|
return {
|
|
43
43
|
...format,
|
|
44
|
-
ast: format.
|
|
44
|
+
ast: format.respectPrefix ? (0, _prefixSelector.default)(prefix, ast) : ast
|
|
45
45
|
};
|
|
46
46
|
});
|
|
47
47
|
// We start with the candidate selector
|
|
@@ -29,7 +29,7 @@ function _default(prefix, selector, prependNegative = false) {
|
|
|
29
29
|
if (prefix === "") {
|
|
30
30
|
return selector;
|
|
31
31
|
}
|
|
32
|
-
let ast = typeof selector === "string" ? (0, _postcssselectorparser.default)().astSync(selector) : selector;
|
|
32
|
+
/** @type {import('postcss-selector-parser').Root} */ let ast = typeof selector === "string" ? (0, _postcssselectorparser.default)().astSync(selector) : selector;
|
|
33
33
|
ast.walkClasses((classSelector)=>{
|
|
34
34
|
let baseClass = classSelector.value;
|
|
35
35
|
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// **Jumpable**
|
|
12
12
|
// Any terminal element may "jump" over combinators when moving to the end of the selector
|
|
13
13
|
//
|
|
14
|
-
// This is a backwards-compat quirk of
|
|
14
|
+
// This is a backwards-compat quirk of pseudo element variants from earlier versions of Tailwind CSS.
|
|
15
15
|
/** @typedef {'terminal' | 'actionable' | 'jumpable'} PseudoProperty */ /** @type {Record<string, PseudoProperty[]>} */ "use strict";
|
|
16
16
|
Object.defineProperty(exports, "__esModule", {
|
|
17
17
|
value: true
|
|
@@ -23,12 +23,14 @@ Object.defineProperty(exports, "movePseudos", {
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
let elementProperties = {
|
|
26
|
+
// Pseudo elements from the spec
|
|
26
27
|
"::after": [
|
|
27
28
|
"terminal",
|
|
28
29
|
"jumpable"
|
|
29
30
|
],
|
|
30
31
|
"::backdrop": [
|
|
31
|
-
"terminal"
|
|
32
|
+
"terminal",
|
|
33
|
+
"jumpable"
|
|
32
34
|
],
|
|
33
35
|
"::before": [
|
|
34
36
|
"terminal",
|
|
@@ -52,17 +54,20 @@ let elementProperties = {
|
|
|
52
54
|
"terminal"
|
|
53
55
|
],
|
|
54
56
|
"::marker": [
|
|
55
|
-
"terminal"
|
|
57
|
+
"terminal",
|
|
58
|
+
"jumpable"
|
|
56
59
|
],
|
|
57
60
|
"::part": [
|
|
58
61
|
"terminal",
|
|
59
62
|
"actionable"
|
|
60
63
|
],
|
|
61
64
|
"::placeholder": [
|
|
62
|
-
"terminal"
|
|
65
|
+
"terminal",
|
|
66
|
+
"jumpable"
|
|
63
67
|
],
|
|
64
68
|
"::selection": [
|
|
65
|
-
"terminal"
|
|
69
|
+
"terminal",
|
|
70
|
+
"jumpable"
|
|
66
71
|
],
|
|
67
72
|
"::slotted": [
|
|
68
73
|
"terminal"
|
|
@@ -73,42 +78,20 @@ let elementProperties = {
|
|
|
73
78
|
"::target-text": [
|
|
74
79
|
"terminal"
|
|
75
80
|
],
|
|
76
|
-
//
|
|
81
|
+
// Pseudo elements from the spec with special rules
|
|
77
82
|
"::file-selector-button": [
|
|
78
83
|
"terminal",
|
|
79
84
|
"actionable"
|
|
80
85
|
],
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
// Library-specific pseudo elements used by component libraries
|
|
87
|
+
// These are Shadow DOM-like
|
|
88
|
+
"::deep": [
|
|
83
89
|
"actionable"
|
|
84
90
|
],
|
|
85
|
-
|
|
86
|
-
"::-webkit-scrollbar": [
|
|
87
|
-
"terminal",
|
|
91
|
+
"::v-deep": [
|
|
88
92
|
"actionable"
|
|
89
93
|
],
|
|
90
|
-
"
|
|
91
|
-
"terminal",
|
|
92
|
-
"actionable"
|
|
93
|
-
],
|
|
94
|
-
"::-webkit-scrollbar-thumb": [
|
|
95
|
-
"terminal",
|
|
96
|
-
"actionable"
|
|
97
|
-
],
|
|
98
|
-
"::-webkit-scrollbar-track": [
|
|
99
|
-
"terminal",
|
|
100
|
-
"actionable"
|
|
101
|
-
],
|
|
102
|
-
"::-webkit-scrollbar-track-piece": [
|
|
103
|
-
"terminal",
|
|
104
|
-
"actionable"
|
|
105
|
-
],
|
|
106
|
-
"::-webkit-scrollbar-corner": [
|
|
107
|
-
"terminal",
|
|
108
|
-
"actionable"
|
|
109
|
-
],
|
|
110
|
-
"::-webkit-resizer": [
|
|
111
|
-
"terminal",
|
|
94
|
+
"::ng-deep": [
|
|
112
95
|
"actionable"
|
|
113
96
|
],
|
|
114
97
|
// Note: As a rule, double colons (::) should be used instead of a single colon
|
|
@@ -133,8 +116,9 @@ let elementProperties = {
|
|
|
133
116
|
],
|
|
134
117
|
// The default value is used when the pseudo-element is not recognized
|
|
135
118
|
// Because it's not recognized, we don't know if it's terminal or not
|
|
136
|
-
// So we assume it can
|
|
119
|
+
// So we assume it can be moved AND can have user-action pseudo classes attached to it
|
|
137
120
|
__default__: [
|
|
121
|
+
"terminal",
|
|
138
122
|
"actionable"
|
|
139
123
|
]
|
|
140
124
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) Bogdan Chadkin <trysound@yandex.ru>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
|
4
|
+
obtaining a copy of this software and associated documentation
|
|
5
|
+
files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the
|
|
9
|
+
Software is furnished to do so, subject to the following
|
|
10
|
+
conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var parse = require("./parse");
|
|
3
|
+
var walk = require("./walk");
|
|
4
|
+
var stringify = require("./stringify");
|
|
5
|
+
function ValueParser(value) {
|
|
6
|
+
if (this instanceof ValueParser) {
|
|
7
|
+
this.nodes = parse(value);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
return new ValueParser(value);
|
|
11
|
+
}
|
|
12
|
+
ValueParser.prototype.toString = function() {
|
|
13
|
+
return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
|
|
14
|
+
};
|
|
15
|
+
ValueParser.prototype.walk = function(cb, bubble) {
|
|
16
|
+
walk(this.nodes, cb, bubble);
|
|
17
|
+
return this;
|
|
18
|
+
};
|
|
19
|
+
ValueParser.unit = require("./unit");
|
|
20
|
+
ValueParser.walk = walk;
|
|
21
|
+
ValueParser.stringify = stringify;
|
|
22
|
+
module.exports = ValueParser;
|