tailwindcss 3.0.24 → 3.1.0
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 +57 -3
- package/colors.d.ts +3 -0
- package/defaultConfig.d.ts +3 -0
- package/defaultTheme.d.ts +3 -0
- package/lib/cli-peer-dependencies.js +8 -3
- package/lib/cli.js +118 -77
- package/lib/corePluginList.js +1 -0
- package/lib/corePlugins.js +146 -117
- package/lib/css/preflight.css +1 -8
- package/lib/featureFlags.js +8 -6
- package/lib/index.js +10 -13
- package/lib/lib/cacheInvalidation.js +32 -14
- package/lib/lib/collapseAdjacentRules.js +5 -3
- package/lib/lib/defaultExtractor.js +191 -32
- package/lib/lib/evaluateTailwindFunctions.js +22 -13
- package/lib/lib/expandApplyAtRules.js +232 -195
- package/lib/lib/expandTailwindAtRules.js +40 -26
- package/lib/lib/generateRules.js +106 -42
- package/lib/lib/regex.js +52 -0
- package/lib/lib/resolveDefaultsAtRules.js +6 -9
- package/lib/lib/setupContextUtils.js +131 -79
- package/lib/lib/setupTrackingContext.js +7 -9
- package/lib/lib/sharedState.js +1 -2
- package/lib/lib/substituteScreenAtRules.js +1 -2
- package/lib/postcss-plugins/nesting/plugin.js +1 -2
- package/lib/util/buildMediaQuery.js +1 -2
- package/lib/util/cloneDeep.js +2 -4
- package/lib/util/color.js +26 -36
- package/lib/util/createPlugin.js +1 -2
- package/lib/util/createUtilityPlugin.js +1 -2
- package/lib/util/dataTypes.js +14 -12
- package/lib/util/flattenColorPalette.js +2 -5
- package/lib/util/formatVariantSelector.js +64 -57
- package/lib/util/getAllConfigs.js +10 -5
- package/lib/util/isValidArbitraryValue.js +1 -2
- package/lib/util/log.js +2 -3
- package/lib/util/negateValue.js +1 -2
- package/lib/util/normalizeConfig.js +33 -23
- package/lib/util/normalizeScreens.js +1 -2
- package/lib/util/parseAnimationValue.js +1 -2
- package/lib/util/parseBoxShadowValue.js +2 -43
- package/lib/util/pluginUtils.js +11 -3
- package/lib/util/resolveConfig.js +57 -34
- package/lib/util/splitAtTopLevelOnly.js +90 -0
- package/lib/util/transformThemeValue.js +4 -2
- package/lib/util/validateConfig.js +21 -0
- package/lib/util/withAlphaVariable.js +5 -5
- package/package.json +21 -16
- package/peers/index.js +3264 -1330
- package/plugin.d.ts +11 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +97 -33
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +57 -40
- package/src/css/preflight.css +1 -8
- package/src/featureFlags.js +2 -2
- package/src/index.js +0 -2
- package/src/lib/collapseAdjacentRules.js +5 -1
- package/src/lib/defaultExtractor.js +177 -35
- package/src/lib/evaluateTailwindFunctions.js +20 -4
- package/src/lib/expandApplyAtRules.js +247 -188
- package/src/lib/expandTailwindAtRules.js +4 -4
- package/src/lib/generateRules.js +69 -5
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +1 -1
- package/src/lib/setupContextUtils.js +103 -39
- package/src/lib/setupTrackingContext.js +4 -0
- package/src/util/color.js +20 -18
- package/src/util/dataTypes.js +11 -5
- package/src/util/formatVariantSelector.js +79 -62
- package/src/util/getAllConfigs.js +7 -0
- package/src/util/log.js +1 -1
- package/src/util/normalizeConfig.js +0 -8
- package/src/util/parseBoxShadowValue.js +3 -50
- package/src/util/pluginUtils.js +13 -1
- package/src/util/resolveConfig.js +66 -54
- package/src/util/splitAtTopLevelOnly.js +71 -0
- package/src/util/toPath.js +1 -1
- package/src/util/transformThemeValue.js +4 -2
- package/src/util/validateConfig.js +13 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +2 -3
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +325 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/index.d.ts +1 -0
package/lib/lib/generateRules.js
CHANGED
|
@@ -14,36 +14,56 @@ var sharedState = _interopRequireWildcard(require("./sharedState"));
|
|
|
14
14
|
var _formatVariantSelector = require("../util/formatVariantSelector");
|
|
15
15
|
var _nameClass = require("../util/nameClass");
|
|
16
16
|
var _dataTypes = require("../util/dataTypes");
|
|
17
|
+
var _setupContextUtils = require("./setupContextUtils");
|
|
17
18
|
var _isValidArbitraryValue = _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
|
19
|
+
var _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
|
|
20
|
+
var _featureFlags = require("../featureFlags");
|
|
18
21
|
function _interopRequireDefault(obj) {
|
|
19
22
|
return obj && obj.__esModule ? obj : {
|
|
20
23
|
default: obj
|
|
21
24
|
};
|
|
22
25
|
}
|
|
26
|
+
function _getRequireWildcardCache() {
|
|
27
|
+
if (typeof WeakMap !== "function") return null;
|
|
28
|
+
var cache = new WeakMap();
|
|
29
|
+
_getRequireWildcardCache = function() {
|
|
30
|
+
return cache;
|
|
31
|
+
};
|
|
32
|
+
return cache;
|
|
33
|
+
}
|
|
23
34
|
function _interopRequireWildcard(obj) {
|
|
24
35
|
if (obj && obj.__esModule) {
|
|
25
36
|
return obj;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
}
|
|
38
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
39
|
+
return {
|
|
40
|
+
default: obj
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
var cache = _getRequireWildcardCache();
|
|
44
|
+
if (cache && cache.has(obj)) {
|
|
45
|
+
return cache.get(obj);
|
|
46
|
+
}
|
|
47
|
+
var newObj = {};
|
|
48
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
|
+
for(var key in obj){
|
|
50
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
51
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
52
|
+
if (desc && (desc.get || desc.set)) {
|
|
53
|
+
Object.defineProperty(newObj, key, desc);
|
|
54
|
+
} else {
|
|
55
|
+
newObj[key] = obj[key];
|
|
38
56
|
}
|
|
39
57
|
}
|
|
40
|
-
newObj.default = obj;
|
|
41
|
-
return newObj;
|
|
42
58
|
}
|
|
59
|
+
newObj.default = obj;
|
|
60
|
+
if (cache) {
|
|
61
|
+
cache.set(obj, newObj);
|
|
62
|
+
}
|
|
63
|
+
return newObj;
|
|
43
64
|
}
|
|
44
65
|
let classNameParser = (0, _postcssSelectorParser).default((selectors)=>{
|
|
45
|
-
return selectors.first.filter(({ type })=>type === "class"
|
|
46
|
-
).pop().value;
|
|
66
|
+
return selectors.first.filter(({ type })=>type === "class").pop().value;
|
|
47
67
|
});
|
|
48
68
|
function getClassNameFromSelector(selector) {
|
|
49
69
|
return classNameParser.transformSync(selector);
|
|
@@ -126,8 +146,7 @@ function applyImportant(matches, classCandidate) {
|
|
|
126
146
|
}
|
|
127
147
|
return className;
|
|
128
148
|
});
|
|
129
|
-
r.walkDecls((d)=>d.important = true
|
|
130
|
-
);
|
|
149
|
+
r.walkDecls((d)=>d.important = true);
|
|
131
150
|
});
|
|
132
151
|
result.push([
|
|
133
152
|
{
|
|
@@ -151,8 +170,30 @@ function applyVariant(variant, matches, context) {
|
|
|
151
170
|
if (matches.length === 0) {
|
|
152
171
|
return matches;
|
|
153
172
|
}
|
|
173
|
+
let args;
|
|
174
|
+
// Find partial arbitrary variants
|
|
175
|
+
if (variant.endsWith("]") && !variant.startsWith("[")) {
|
|
176
|
+
args = variant.slice(variant.lastIndexOf("[") + 1, -1);
|
|
177
|
+
variant = variant.slice(0, variant.indexOf(args) - 1 /* - */ - 1 /* [ */ );
|
|
178
|
+
}
|
|
179
|
+
// Register arbitrary variants
|
|
180
|
+
if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
|
|
181
|
+
let selector = (0, _dataTypes).normalize(variant.slice(1, -1));
|
|
182
|
+
if (!(0, _setupContextUtils).isValidVariantFormatString(selector)) {
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
let fn = (0, _setupContextUtils).parseVariant(selector);
|
|
186
|
+
let sort = Array.from(context.variantOrder.values()).pop() << 1n;
|
|
187
|
+
context.variantMap.set(variant, [
|
|
188
|
+
[
|
|
189
|
+
sort,
|
|
190
|
+
fn
|
|
191
|
+
]
|
|
192
|
+
]);
|
|
193
|
+
context.variantOrder.set(variant, sort);
|
|
194
|
+
}
|
|
154
195
|
if (context.variantMap.has(variant)) {
|
|
155
|
-
let variantFunctionTuples = context.variantMap.get(variant);
|
|
196
|
+
let variantFunctionTuples = context.variantMap.get(variant).slice();
|
|
156
197
|
let result = [];
|
|
157
198
|
for (let [meta, rule1] of matches){
|
|
158
199
|
// Don't generate variants for user css
|
|
@@ -170,8 +211,7 @@ function applyVariant(variant, matches, context) {
|
|
|
170
211
|
let originals = new Map();
|
|
171
212
|
function prepareBackup() {
|
|
172
213
|
if (originals.size > 0) return; // Already prepared, chicken out
|
|
173
|
-
clone.walkRules((rule)=>originals.set(rule, rule.selector)
|
|
174
|
-
);
|
|
214
|
+
clone.walkRules((rule)=>originals.set(rule, rule.selector));
|
|
175
215
|
}
|
|
176
216
|
function modifySelectors(modifierFunction) {
|
|
177
217
|
prepareBackup();
|
|
@@ -207,8 +247,28 @@ function applyVariant(variant, matches, context) {
|
|
|
207
247
|
},
|
|
208
248
|
format (selectorFormat) {
|
|
209
249
|
collectedFormats.push(selectorFormat);
|
|
210
|
-
}
|
|
250
|
+
},
|
|
251
|
+
args
|
|
211
252
|
});
|
|
253
|
+
// It can happen that a list of format strings is returned from within the function. In that
|
|
254
|
+
// case, we have to process them as well. We can use the existing `variantSort`.
|
|
255
|
+
if (Array.isArray(ruleWithVariant)) {
|
|
256
|
+
for (let [idx, variantFunction] of ruleWithVariant.entries()){
|
|
257
|
+
// This is a little bit scary since we are pushing to an array of items that we are
|
|
258
|
+
// currently looping over. However, you can also think of it like a processing queue
|
|
259
|
+
// where you keep handling jobs until everything is done and each job can queue more
|
|
260
|
+
// jobs if needed.
|
|
261
|
+
variantFunctionTuples.push([
|
|
262
|
+
// TODO: This could have potential bugs if we shift the sort order from variant A far
|
|
263
|
+
// enough into the sort space of variant B. The chances are low, but if this happens
|
|
264
|
+
// then this might be the place too look at. One potential solution to this problem is
|
|
265
|
+
// reserving additional X places for these 'unknown' variants in between.
|
|
266
|
+
variantSort | BigInt(idx << ruleWithVariant.length),
|
|
267
|
+
variantFunction,
|
|
268
|
+
]);
|
|
269
|
+
}
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
212
272
|
if (typeof ruleWithVariant === "string") {
|
|
213
273
|
collectedFormats.push(ruleWithVariant);
|
|
214
274
|
}
|
|
@@ -366,8 +426,7 @@ function extractArbitraryProperty(classCandidate, context) {
|
|
|
366
426
|
[(0, _nameClass).asClass(classCandidate)]: {
|
|
367
427
|
[property]: normalized
|
|
368
428
|
}
|
|
369
|
-
})
|
|
370
|
-
,
|
|
429
|
+
}),
|
|
371
430
|
],
|
|
372
431
|
];
|
|
373
432
|
}
|
|
@@ -390,7 +449,8 @@ function* resolveMatchedPlugins(classCandidate, context) {
|
|
|
390
449
|
let negative = false;
|
|
391
450
|
const twConfigPrefix = context.tailwindConfig.prefix;
|
|
392
451
|
const twConfigPrefixLen = twConfigPrefix.length;
|
|
393
|
-
|
|
452
|
+
const hasMatchingPrefix = candidatePrefix.startsWith(twConfigPrefix) || candidatePrefix.startsWith(`-${twConfigPrefix}`);
|
|
453
|
+
if (candidatePrefix[twConfigPrefixLen] === "-" && hasMatchingPrefix) {
|
|
394
454
|
negative = true;
|
|
395
455
|
candidatePrefix = twConfigPrefix + candidatePrefix.slice(twConfigPrefixLen + 1);
|
|
396
456
|
}
|
|
@@ -415,7 +475,7 @@ function splitWithSeparator(input, separator) {
|
|
|
415
475
|
sharedState.NOT_ON_DEMAND
|
|
416
476
|
];
|
|
417
477
|
}
|
|
418
|
-
return
|
|
478
|
+
return Array.from((0, _splitAtTopLevelOnlyJs).splitAtTopLevelOnly(input, separator));
|
|
419
479
|
}
|
|
420
480
|
function* recordCandidates(matches, classCandidate) {
|
|
421
481
|
for (const match of matches){
|
|
@@ -426,7 +486,7 @@ function* recordCandidates(matches, classCandidate) {
|
|
|
426
486
|
yield match;
|
|
427
487
|
}
|
|
428
488
|
}
|
|
429
|
-
function* resolveMatches(candidate, context) {
|
|
489
|
+
function* resolveMatches(candidate, context, original = candidate) {
|
|
430
490
|
let separator = context.tailwindConfig.separator;
|
|
431
491
|
let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse();
|
|
432
492
|
let important = false;
|
|
@@ -434,6 +494,14 @@ function* resolveMatches(candidate, context) {
|
|
|
434
494
|
important = true;
|
|
435
495
|
classCandidate = classCandidate.slice(1);
|
|
436
496
|
}
|
|
497
|
+
if ((0, _featureFlags).flagEnabled(context.tailwindConfig, "variantGrouping")) {
|
|
498
|
+
if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
|
|
499
|
+
let base = variants.slice().reverse().join(separator);
|
|
500
|
+
for (let part of (0, _splitAtTopLevelOnlyJs).splitAtTopLevelOnly(classCandidate.slice(1, -1), ",")){
|
|
501
|
+
yield* resolveMatches(base + separator + part, context, original);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
437
505
|
// TODO: Reintroduce this in ways that doesn't break on false positives
|
|
438
506
|
// function sortAgainst(toSort, against) {
|
|
439
507
|
// return toSort.slice().sort((a, z) => {
|
|
@@ -499,8 +567,7 @@ function* resolveMatches(candidate, context) {
|
|
|
499
567
|
var ref1;
|
|
500
568
|
let typesPerPlugin = matches.map((match)=>new Set([
|
|
501
569
|
...(ref1 = typesByMatches.get(match)) !== null && ref1 !== void 0 ? ref1 : []
|
|
502
|
-
])
|
|
503
|
-
);
|
|
570
|
+
]));
|
|
504
571
|
// Remove duplicates, so that we can detect proper unique types for each plugin.
|
|
505
572
|
for (let pluginTypes of typesPerPlugin){
|
|
506
573
|
for (let type of pluginTypes){
|
|
@@ -518,13 +585,9 @@ function* resolveMatches(candidate, context) {
|
|
|
518
585
|
let messages = [];
|
|
519
586
|
for (let [idx, group] of typesPerPlugin.entries()){
|
|
520
587
|
for (let type of group){
|
|
521
|
-
let rules = matches[idx].map(([, rule])=>rule
|
|
522
|
-
|
|
523
|
-
.
|
|
524
|
-
).map((x)=>` ${x}`
|
|
525
|
-
) // Re-indent
|
|
526
|
-
.join("\n")
|
|
527
|
-
).join("\n\n");
|
|
588
|
+
let rules = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
|
|
589
|
+
.map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
|
|
590
|
+
.join("\n")).join("\n\n");
|
|
528
591
|
messages.push(` Use \`${candidate.replace("[", `[${type}:`)}\` for \`${rules.trim()}\``);
|
|
529
592
|
break;
|
|
530
593
|
}
|
|
@@ -536,9 +599,7 @@ function* resolveMatches(candidate, context) {
|
|
|
536
599
|
]);
|
|
537
600
|
continue;
|
|
538
601
|
}
|
|
539
|
-
matches = matches.map((list)=>list.filter((match)=>isParsableNode(match[1])
|
|
540
|
-
)
|
|
541
|
-
);
|
|
602
|
+
matches = matches.map((list)=>list.filter((match)=>isParsableNode(match[1])));
|
|
542
603
|
}
|
|
543
604
|
matches = matches.flat();
|
|
544
605
|
matches = Array.from(recordCandidates(matches, classCandidate));
|
|
@@ -563,10 +624,13 @@ function* resolveMatches(candidate, context) {
|
|
|
563
624
|
]
|
|
564
625
|
});
|
|
565
626
|
container.walkRules((rule)=>{
|
|
627
|
+
var ref;
|
|
566
628
|
if (inKeyframes(rule)) return;
|
|
629
|
+
var ref2;
|
|
567
630
|
rule.selector = (0, _formatVariantSelector).finalizeSelector(finalFormat, {
|
|
568
631
|
selector: rule.selector,
|
|
569
|
-
candidate,
|
|
632
|
+
candidate: original,
|
|
633
|
+
base: candidate.split(new RegExp(`\\${(ref2 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref2 !== void 0 ? ref2 : ":"}(?![^[]*\\])`)).pop(),
|
|
570
634
|
context
|
|
571
635
|
});
|
|
572
636
|
});
|
|
@@ -576,7 +640,6 @@ function* resolveMatches(candidate, context) {
|
|
|
576
640
|
}
|
|
577
641
|
}
|
|
578
642
|
}
|
|
579
|
-
exports.resolveMatches = resolveMatches;
|
|
580
643
|
function inKeyframes(rule) {
|
|
581
644
|
return rule.parent && rule.parent.type === "atrule" && rule.parent.name === "keyframes";
|
|
582
645
|
}
|
|
@@ -640,7 +703,8 @@ function generateRules(candidates, context) {
|
|
|
640
703
|
];
|
|
641
704
|
});
|
|
642
705
|
}
|
|
643
|
-
exports.generateRules = generateRules;
|
|
644
706
|
function isArbitraryValue(input) {
|
|
645
707
|
return input.startsWith("[") && input.endsWith("]");
|
|
646
708
|
}
|
|
709
|
+
exports.resolveMatches = resolveMatches;
|
|
710
|
+
exports.generateRules = generateRules;
|
package/lib/lib/regex.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.pattern = pattern;
|
|
6
|
+
exports.withoutCapturing = withoutCapturing;
|
|
7
|
+
exports.any = any;
|
|
8
|
+
exports.optional = optional;
|
|
9
|
+
exports.zeroOrMore = zeroOrMore;
|
|
10
|
+
exports.nestedBrackets = nestedBrackets;
|
|
11
|
+
exports.escape = escape;
|
|
12
|
+
const REGEX_SPECIAL = /[\\^$.*+?()[\]{}|]/g;
|
|
13
|
+
const REGEX_HAS_SPECIAL = RegExp(REGEX_SPECIAL.source);
|
|
14
|
+
/**
|
|
15
|
+
* @param {string|RegExp|Array<string|RegExp>} source
|
|
16
|
+
*/ function toSource(source) {
|
|
17
|
+
source = Array.isArray(source) ? source : [
|
|
18
|
+
source
|
|
19
|
+
];
|
|
20
|
+
source = source.map((item)=>item instanceof RegExp ? item.source : item);
|
|
21
|
+
return source.join("");
|
|
22
|
+
}
|
|
23
|
+
function pattern(source) {
|
|
24
|
+
return new RegExp(toSource(source), "g");
|
|
25
|
+
}
|
|
26
|
+
function withoutCapturing(source) {
|
|
27
|
+
return new RegExp(`(?:${toSource(source)})`, "g");
|
|
28
|
+
}
|
|
29
|
+
function any(sources) {
|
|
30
|
+
return `(?:${sources.map(toSource).join("|")})`;
|
|
31
|
+
}
|
|
32
|
+
function optional(source) {
|
|
33
|
+
return `(?:${toSource(source)})?`;
|
|
34
|
+
}
|
|
35
|
+
function zeroOrMore(source) {
|
|
36
|
+
return `(?:${toSource(source)})*`;
|
|
37
|
+
}
|
|
38
|
+
function nestedBrackets(open, close, depth = 1) {
|
|
39
|
+
return withoutCapturing([
|
|
40
|
+
escape(open),
|
|
41
|
+
/[^\s]*/,
|
|
42
|
+
depth === 1 ? `[^${escape(open)}${escape(close)}\s]*` : any([
|
|
43
|
+
`[^${escape(open)}${escape(close)}\s]*`,
|
|
44
|
+
nestedBrackets(open, close, depth - 1)
|
|
45
|
+
]),
|
|
46
|
+
/[^\s]*/,
|
|
47
|
+
escape(close),
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
function escape(string) {
|
|
51
|
+
return string && REGEX_HAS_SPECIAL.test(string) ? string.replace(REGEX_SPECIAL, "\\$&") : string || "";
|
|
52
|
+
}
|
|
@@ -52,8 +52,7 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
52
52
|
universalRule.selectors = [
|
|
53
53
|
...selectors
|
|
54
54
|
];
|
|
55
|
-
universalRule.append(universal.nodes.map((node)=>node.clone()
|
|
56
|
-
));
|
|
55
|
+
universalRule.append(universal.nodes.map((node)=>node.clone()));
|
|
57
56
|
universal.before(universalRule);
|
|
58
57
|
}
|
|
59
58
|
} else {
|
|
@@ -63,7 +62,8 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
63
62
|
universalRule.selectors = [
|
|
64
63
|
"*",
|
|
65
64
|
"::before",
|
|
66
|
-
"::after"
|
|
65
|
+
"::after",
|
|
66
|
+
"::backdrop"
|
|
67
67
|
];
|
|
68
68
|
universalRule.append(universal.nodes);
|
|
69
69
|
universal.before(universalRule);
|
|
@@ -109,14 +109,12 @@ function minimumImpactSelector(nodes) {
|
|
|
109
109
|
"id",
|
|
110
110
|
"attribute"
|
|
111
111
|
]);
|
|
112
|
-
let splitPointIdx = rest.findIndex((n)=>searchFor.has(n.type)
|
|
113
|
-
);
|
|
112
|
+
let splitPointIdx = rest.findIndex((n)=>searchFor.has(n.type));
|
|
114
113
|
if (splitPointIdx === -1) return rest.reverse().join("").trim();
|
|
115
114
|
let node1 = rest[splitPointIdx];
|
|
116
115
|
let bestNode = getNode[node1.type] ? getNode[node1.type](node1) : node1;
|
|
117
116
|
rest = rest.slice(0, splitPointIdx);
|
|
118
|
-
let combinatorIdx = rest.findIndex((n)=>n.type === "combinator" && n.value === ">"
|
|
119
|
-
);
|
|
117
|
+
let combinatorIdx = rest.findIndex((n)=>n.type === "combinator" && n.value === ">");
|
|
120
118
|
if (combinatorIdx !== -1) {
|
|
121
119
|
rest.splice(0, combinatorIdx);
|
|
122
120
|
rest.unshift(_postcssSelectorParser.default.universal());
|
|
@@ -128,8 +126,7 @@ function minimumImpactSelector(nodes) {
|
|
|
128
126
|
}
|
|
129
127
|
let elementSelectorParser = (0, _postcssSelectorParser).default((selectors)=>{
|
|
130
128
|
return selectors.map((s)=>{
|
|
131
|
-
let nodes = s.split((n)=>n.type === "combinator" && n.value === " "
|
|
132
|
-
).pop();
|
|
129
|
+
let nodes = s.split((n)=>n.type === "combinator" && n.value === " ").pop();
|
|
133
130
|
return minimumImpactSelector(nodes);
|
|
134
131
|
});
|
|
135
132
|
});
|