tailwindcss 3.1.4 → 3.1.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 +37 -2
- package/defaultTheme.d.ts +2 -1
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +78 -75
- package/lib/constants.js +19 -12
- package/lib/corePluginList.js +5 -3
- package/lib/corePlugins.js +197 -187
- package/lib/featureFlags.js +14 -7
- package/lib/index.js +9 -6
- package/lib/lib/cacheInvalidation.js +18 -15
- package/lib/lib/collapseAdjacentRules.js +14 -11
- package/lib/lib/collapseDuplicateDeclarations.js +11 -8
- package/lib/lib/defaultExtractor.js +41 -33
- package/lib/lib/detectNesting.js +4 -1
- package/lib/lib/evaluateTailwindFunctions.js +75 -44
- package/lib/lib/expandApplyAtRules.js +45 -42
- package/lib/lib/expandTailwindAtRules.js +153 -150
- package/lib/lib/generateRules.js +84 -70
- package/lib/lib/getModuleDependencies.js +21 -18
- package/lib/lib/normalizeTailwindDirectives.js +10 -7
- package/lib/lib/partitionApplyAtRules.js +14 -11
- package/lib/lib/regex.js +15 -7
- package/lib/lib/resolveDefaultsAtRules.js +92 -85
- package/lib/lib/setupContextUtils.js +115 -97
- package/lib/lib/setupTrackingContext.js +82 -75
- package/lib/lib/sharedState.js +15 -8
- package/lib/lib/substituteScreenAtRules.js +8 -5
- package/lib/postcss-plugins/nesting/index.js +7 -5
- package/lib/postcss-plugins/nesting/plugin.js +7 -4
- package/lib/processTailwindFeatures.js +34 -31
- package/lib/public/colors.js +6 -4
- package/lib/public/create-plugin.js +6 -4
- package/lib/public/default-config.js +7 -5
- package/lib/public/default-theme.js +7 -5
- package/lib/public/resolve-config.js +13 -10
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +5 -2
- package/lib/util/cloneDeep.js +4 -1
- package/lib/util/cloneNodes.js +9 -2
- package/lib/util/color.js +11 -3
- package/lib/util/configurePlugins.js +4 -1
- package/lib/util/createPlugin.js +5 -3
- package/lib/util/createUtilityPlugin.js +13 -10
- package/lib/util/dataTypes.js +27 -19
- package/lib/util/defaults.js +4 -1
- package/lib/util/escapeClassName.js +12 -9
- package/lib/util/escapeCommas.js +4 -1
- package/lib/util/flattenColorPalette.js +5 -3
- package/lib/util/formatVariantSelector.js +23 -15
- package/lib/util/getAllConfigs.js +12 -9
- package/lib/util/hashConfig.js +10 -7
- package/lib/util/isKeyframeRule.js +4 -1
- package/lib/util/isPlainObject.js +4 -1
- package/lib/util/isValidArbitraryValue.js +33 -24
- package/lib/util/log.js +12 -5
- package/lib/util/nameClass.js +16 -8
- package/lib/util/negateValue.js +4 -1
- package/lib/util/normalizeConfig.js +26 -23
- package/lib/util/normalizeScreens.js +17 -2
- package/lib/util/parseAnimationValue.js +42 -39
- package/lib/util/parseBoxShadowValue.js +12 -4
- package/lib/util/parseDependency.js +35 -32
- package/lib/util/parseObjectStyles.js +14 -11
- package/lib/util/pluginUtils.js +28 -20
- package/lib/util/prefixSelector.js +6 -3
- package/lib/util/removeAlphaVariables.js +13 -2
- package/lib/util/resolveConfig.js +55 -52
- package/lib/util/resolveConfigPath.js +20 -17
- package/lib/util/responsive.js +12 -9
- package/lib/util/splitAtTopLevelOnly.js +16 -13
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +4 -1
- package/lib/util/toPath.js +18 -2
- package/lib/util/transformThemeValue.js +10 -7
- package/lib/util/validateConfig.js +5 -2
- package/lib/util/withAlphaVariable.js +30 -22
- package/package.json +12 -12
- package/peers/index.js +24 -10
- package/resolveConfig.d.ts +3 -0
- package/scripts/generate-types.js +53 -0
- package/scripts/type-utils.js +27 -0
- package/src/corePlugins.js +2 -1
- package/src/lib/defaultExtractor.js +7 -1
- package/src/lib/evaluateTailwindFunctions.js +41 -15
- package/src/lib/generateRules.js +10 -1
- package/src/lib/setupContextUtils.js +15 -2
- package/src/util/cloneNodes.js +5 -1
- package/src/util/formatVariantSelector.js +3 -1
- package/types/config.d.ts +7 -5
- package/types/generated/default-theme.d.ts +331 -0
package/lib/lib/generateRules.js
CHANGED
|
@@ -2,37 +2,46 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
resolveMatches: ()=>resolveMatches,
|
|
13
|
+
generateRules: ()=>generateRules
|
|
14
|
+
});
|
|
15
|
+
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
16
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
17
|
+
const _parseObjectStyles = /*#__PURE__*/ _interopRequireDefault(require("../util/parseObjectStyles"));
|
|
18
|
+
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("../util/isPlainObject"));
|
|
19
|
+
const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
|
|
20
|
+
const _pluginUtils = require("../util/pluginUtils");
|
|
21
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
|
22
|
+
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
|
|
23
|
+
const _formatVariantSelector = require("../util/formatVariantSelector");
|
|
24
|
+
const _nameClass = require("../util/nameClass");
|
|
25
|
+
const _dataTypes = require("../util/dataTypes");
|
|
26
|
+
const _setupContextUtils = require("./setupContextUtils");
|
|
27
|
+
const _isValidArbitraryValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
|
28
|
+
const _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
|
|
29
|
+
const _featureFlags = require("../featureFlags");
|
|
21
30
|
function _interopRequireDefault(obj) {
|
|
22
31
|
return obj && obj.__esModule ? obj : {
|
|
23
32
|
default: obj
|
|
24
33
|
};
|
|
25
34
|
}
|
|
26
|
-
function _getRequireWildcardCache() {
|
|
35
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
27
36
|
if (typeof WeakMap !== "function") return null;
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
var cacheBabelInterop = new WeakMap();
|
|
38
|
+
var cacheNodeInterop = new WeakMap();
|
|
39
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
40
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
41
|
+
})(nodeInterop);
|
|
33
42
|
}
|
|
34
|
-
function _interopRequireWildcard(obj) {
|
|
35
|
-
if (obj && obj.__esModule) {
|
|
43
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
44
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
36
45
|
return obj;
|
|
37
46
|
}
|
|
38
47
|
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
@@ -40,14 +49,14 @@ function _interopRequireWildcard(obj) {
|
|
|
40
49
|
default: obj
|
|
41
50
|
};
|
|
42
51
|
}
|
|
43
|
-
var cache = _getRequireWildcardCache();
|
|
52
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
44
53
|
if (cache && cache.has(obj)) {
|
|
45
54
|
return cache.get(obj);
|
|
46
55
|
}
|
|
47
56
|
var newObj = {};
|
|
48
57
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
58
|
for(var key in obj){
|
|
50
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
59
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
51
60
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
52
61
|
if (desc && (desc.get || desc.set)) {
|
|
53
62
|
Object.defineProperty(newObj, key, desc);
|
|
@@ -62,7 +71,7 @@ function _interopRequireWildcard(obj) {
|
|
|
62
71
|
}
|
|
63
72
|
return newObj;
|
|
64
73
|
}
|
|
65
|
-
let classNameParser = (0, _postcssSelectorParser
|
|
74
|
+
let classNameParser = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
66
75
|
return selectors.first.filter(({ type })=>type === "class").pop().value;
|
|
67
76
|
});
|
|
68
77
|
function getClassNameFromSelector(selector) {
|
|
@@ -121,7 +130,7 @@ function applyPrefix(matches, context) {
|
|
|
121
130
|
// Not doing this will cause `-tw-top-1` to generate the class `.tw--top-1`
|
|
122
131
|
// The disconnect between candidate <-> class can cause @apply to hard crash.
|
|
123
132
|
let shouldPrependNegative = classCandidate.startsWith("-");
|
|
124
|
-
r.selector = (0, _prefixSelector
|
|
133
|
+
r.selector = (0, _prefixSelector.default)(context.tailwindConfig.prefix, r.selector, shouldPrependNegative);
|
|
125
134
|
});
|
|
126
135
|
match[1] = container.nodes[0];
|
|
127
136
|
}
|
|
@@ -140,7 +149,7 @@ function applyImportant(matches, classCandidate) {
|
|
|
140
149
|
]
|
|
141
150
|
});
|
|
142
151
|
container.walkRules((r)=>{
|
|
143
|
-
r.selector = (0, _pluginUtils
|
|
152
|
+
r.selector = (0, _pluginUtils.updateAllClasses)(r.selector, (className)=>{
|
|
144
153
|
if (className === classCandidate) {
|
|
145
154
|
return `!${className}`;
|
|
146
155
|
}
|
|
@@ -171,6 +180,7 @@ function applyVariant(variant, matches, context) {
|
|
|
171
180
|
return matches;
|
|
172
181
|
}
|
|
173
182
|
let args;
|
|
183
|
+
let isArbitraryVariant = false;
|
|
174
184
|
// Find partial arbitrary variants
|
|
175
185
|
if (variant.endsWith("]") && !variant.startsWith("[")) {
|
|
176
186
|
args = variant.slice(variant.lastIndexOf("[") + 1, -1);
|
|
@@ -178,11 +188,12 @@ function applyVariant(variant, matches, context) {
|
|
|
178
188
|
}
|
|
179
189
|
// Register arbitrary variants
|
|
180
190
|
if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
|
|
181
|
-
let selector = (0, _dataTypes
|
|
182
|
-
if (!(0, _setupContextUtils
|
|
191
|
+
let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
|
|
192
|
+
if (!(0, _setupContextUtils.isValidVariantFormatString)(selector)) {
|
|
183
193
|
return [];
|
|
184
194
|
}
|
|
185
|
-
|
|
195
|
+
isArbitraryVariant = true;
|
|
196
|
+
let fn = (0, _setupContextUtils.parseVariant)(selector);
|
|
186
197
|
let sort = Array.from(context.variantOrder.values()).pop() << 1n;
|
|
187
198
|
context.variantMap.set(variant, [
|
|
188
199
|
[
|
|
@@ -195,14 +206,14 @@ function applyVariant(variant, matches, context) {
|
|
|
195
206
|
if (context.variantMap.has(variant)) {
|
|
196
207
|
let variantFunctionTuples = context.variantMap.get(variant).slice();
|
|
197
208
|
let result = [];
|
|
198
|
-
for (let [meta,
|
|
209
|
+
for (let [meta, rule] of matches){
|
|
199
210
|
// Don't generate variants for user css
|
|
200
211
|
if (meta.layer === "user") {
|
|
201
212
|
continue;
|
|
202
213
|
}
|
|
203
214
|
let container = _postcss.default.root({
|
|
204
215
|
nodes: [
|
|
205
|
-
|
|
216
|
+
rule.clone()
|
|
206
217
|
]
|
|
207
218
|
});
|
|
208
219
|
for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples){
|
|
@@ -256,7 +267,7 @@ function applyVariant(variant, matches, context) {
|
|
|
256
267
|
// It can happen that a list of format strings is returned from within the function. In that
|
|
257
268
|
// case, we have to process them as well. We can use the existing `variantSort`.
|
|
258
269
|
if (Array.isArray(ruleWithVariant)) {
|
|
259
|
-
for (let [idx,
|
|
270
|
+
for (let [idx, variantFunction1] of ruleWithVariant.entries()){
|
|
260
271
|
// This is a little bit scary since we are pushing to an array of items that we are
|
|
261
272
|
// currently looping over. However, you can also think of it like a processing queue
|
|
262
273
|
// where you keep handling jobs until everything is done and each job can queue more
|
|
@@ -267,7 +278,7 @@ function applyVariant(variant, matches, context) {
|
|
|
267
278
|
// then this might be the place too look at. One potential solution to this problem is
|
|
268
279
|
// reserving additional X places for these 'unknown' variants in between.
|
|
269
280
|
variantSort | BigInt(idx << ruleWithVariant.length),
|
|
270
|
-
|
|
281
|
+
variantFunction1,
|
|
271
282
|
// If the clone has been modified we have to pass that back
|
|
272
283
|
// though so each rule can use the modified container
|
|
273
284
|
clone.clone(),
|
|
@@ -296,7 +307,7 @@ function applyVariant(variant, matches, context) {
|
|
|
296
307
|
// as well. E.g.: `${variant}${separator}${className}`.
|
|
297
308
|
// However, plugin authors probably also prepend or append certain
|
|
298
309
|
// classes, pseudos, ids, ...
|
|
299
|
-
let rebuiltBase = (0, _postcssSelectorParser
|
|
310
|
+
let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
300
311
|
selectors.walkClasses((classNode)=>{
|
|
301
312
|
classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
|
|
302
313
|
});
|
|
@@ -329,7 +340,8 @@ function applyVariant(variant, matches, context) {
|
|
|
329
340
|
{
|
|
330
341
|
...meta,
|
|
331
342
|
sort: variantSort | meta.sort,
|
|
332
|
-
collectedFormats: ((_collectedFormats = meta.collectedFormats) !== null && _collectedFormats !== void 0 ? _collectedFormats : []).concat(collectedFormats)
|
|
343
|
+
collectedFormats: ((_collectedFormats = meta.collectedFormats) !== null && _collectedFormats !== void 0 ? _collectedFormats : []).concat(collectedFormats),
|
|
344
|
+
isArbitraryVariant
|
|
333
345
|
},
|
|
334
346
|
clone.nodes[0],
|
|
335
347
|
];
|
|
@@ -342,7 +354,7 @@ function applyVariant(variant, matches, context) {
|
|
|
342
354
|
}
|
|
343
355
|
function parseRules(rule, cache, options = {}) {
|
|
344
356
|
// PostCSS node
|
|
345
|
-
if (!(0, _isPlainObject
|
|
357
|
+
if (!(0, _isPlainObject.default)(rule) && !Array.isArray(rule)) {
|
|
346
358
|
return [
|
|
347
359
|
[
|
|
348
360
|
rule
|
|
@@ -356,7 +368,7 @@ function parseRules(rule, cache, options = {}) {
|
|
|
356
368
|
}
|
|
357
369
|
// Simple object
|
|
358
370
|
if (!cache.has(rule)) {
|
|
359
|
-
cache.set(rule, (0, _parseObjectStyles
|
|
371
|
+
cache.set(rule, (0, _parseObjectStyles.default)(rule));
|
|
360
372
|
}
|
|
361
373
|
return [
|
|
362
374
|
cache.get(rule),
|
|
@@ -417,10 +429,10 @@ function extractArbitraryProperty(classCandidate, context) {
|
|
|
417
429
|
if (!isValidPropName(property)) {
|
|
418
430
|
return null;
|
|
419
431
|
}
|
|
420
|
-
if (!(0, _isValidArbitraryValue
|
|
432
|
+
if (!(0, _isValidArbitraryValue.default)(value)) {
|
|
421
433
|
return null;
|
|
422
434
|
}
|
|
423
|
-
let normalized = (0, _dataTypes
|
|
435
|
+
let normalized = (0, _dataTypes.normalize)(value);
|
|
424
436
|
if (!isParsableCssValue(property, normalized)) {
|
|
425
437
|
return null;
|
|
426
438
|
}
|
|
@@ -431,7 +443,7 @@ function extractArbitraryProperty(classCandidate, context) {
|
|
|
431
443
|
layer: "utilities"
|
|
432
444
|
},
|
|
433
445
|
()=>({
|
|
434
|
-
[(0, _nameClass
|
|
446
|
+
[(0, _nameClass.asClass)(classCandidate)]: {
|
|
435
447
|
[property]: normalized
|
|
436
448
|
}
|
|
437
449
|
}),
|
|
@@ -478,18 +490,21 @@ function* resolveMatchedPlugins(classCandidate, context) {
|
|
|
478
490
|
}
|
|
479
491
|
}
|
|
480
492
|
function splitWithSeparator(input, separator) {
|
|
481
|
-
if (input ===
|
|
493
|
+
if (input === _sharedState.NOT_ON_DEMAND) {
|
|
482
494
|
return [
|
|
483
|
-
|
|
495
|
+
_sharedState.NOT_ON_DEMAND
|
|
484
496
|
];
|
|
485
497
|
}
|
|
486
|
-
return Array.from((0, _splitAtTopLevelOnlyJs
|
|
498
|
+
return Array.from((0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(input, separator));
|
|
487
499
|
}
|
|
488
500
|
function* recordCandidates(matches, classCandidate) {
|
|
489
501
|
for (const match of matches){
|
|
502
|
+
var ref;
|
|
503
|
+
var ref1;
|
|
490
504
|
match[1].raws.tailwind = {
|
|
491
505
|
...match[1].raws.tailwind,
|
|
492
|
-
classCandidate
|
|
506
|
+
classCandidate,
|
|
507
|
+
preserveSource: (ref1 = (ref = match[0].options) === null || ref === void 0 ? void 0 : ref.preserveSource) !== null && ref1 !== void 0 ? ref1 : false
|
|
493
508
|
};
|
|
494
509
|
yield match;
|
|
495
510
|
}
|
|
@@ -502,10 +517,10 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
502
517
|
important = true;
|
|
503
518
|
classCandidate = classCandidate.slice(1);
|
|
504
519
|
}
|
|
505
|
-
if ((0, _featureFlags
|
|
520
|
+
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping")) {
|
|
506
521
|
if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
|
|
507
522
|
let base = variants.slice().reverse().join(separator);
|
|
508
|
-
for (let part of (0, _splitAtTopLevelOnlyJs
|
|
523
|
+
for (let part of (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
|
|
509
524
|
yield* resolveMatches(base + separator + part, context, original);
|
|
510
525
|
}
|
|
511
526
|
}
|
|
@@ -547,18 +562,18 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
547
562
|
}
|
|
548
563
|
}
|
|
549
564
|
} else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
|
|
550
|
-
let
|
|
551
|
-
let [
|
|
552
|
-
for (let
|
|
565
|
+
let ruleSet1 = plugin;
|
|
566
|
+
let [rules1, options1] = parseRules(ruleSet1, context.postCssNodeCache);
|
|
567
|
+
for (let rule1 of rules1){
|
|
553
568
|
matchesPerPlugin.push([
|
|
554
569
|
{
|
|
555
570
|
...sort,
|
|
556
571
|
options: {
|
|
557
572
|
...sort.options,
|
|
558
|
-
...
|
|
573
|
+
...options1
|
|
559
574
|
}
|
|
560
575
|
},
|
|
561
|
-
|
|
576
|
+
rule1
|
|
562
577
|
]);
|
|
563
578
|
}
|
|
564
579
|
}
|
|
@@ -592,11 +607,11 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
592
607
|
}
|
|
593
608
|
let messages = [];
|
|
594
609
|
for (let [idx, group] of typesPerPlugin.entries()){
|
|
595
|
-
for (let
|
|
596
|
-
let
|
|
610
|
+
for (let type1 of group){
|
|
611
|
+
let rules2 = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
|
|
597
612
|
.map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
|
|
598
613
|
.join("\n")).join("\n\n");
|
|
599
|
-
messages.push(` Use \`${candidate.replace("[", `[${
|
|
614
|
+
messages.push(` Use \`${candidate.replace("[", `[${type1}:`)}\` for \`${rules2.trim()}\``);
|
|
600
615
|
break;
|
|
601
616
|
}
|
|
602
617
|
}
|
|
@@ -618,33 +633,34 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
618
633
|
for (let variant of variants){
|
|
619
634
|
matches = applyVariant(variant, matches, context);
|
|
620
635
|
}
|
|
621
|
-
for (let
|
|
622
|
-
|
|
623
|
-
...
|
|
636
|
+
for (let match of matches){
|
|
637
|
+
match[1].raws.tailwind = {
|
|
638
|
+
...match[1].raws.tailwind,
|
|
624
639
|
candidate
|
|
625
640
|
};
|
|
626
641
|
// Apply final format selector
|
|
627
|
-
if (
|
|
628
|
-
let finalFormat = (0, _formatVariantSelector
|
|
642
|
+
if (match[0].collectedFormats) {
|
|
643
|
+
let finalFormat = (0, _formatVariantSelector.formatVariantSelector)("&", ...match[0].collectedFormats);
|
|
629
644
|
let container = _postcss.default.root({
|
|
630
645
|
nodes: [
|
|
631
|
-
|
|
646
|
+
match[1].clone()
|
|
632
647
|
]
|
|
633
648
|
});
|
|
634
649
|
container.walkRules((rule)=>{
|
|
635
650
|
var ref;
|
|
636
651
|
if (inKeyframes(rule)) return;
|
|
637
|
-
var
|
|
638
|
-
rule.selector = (0, _formatVariantSelector
|
|
652
|
+
var ref1;
|
|
653
|
+
rule.selector = (0, _formatVariantSelector.finalizeSelector)(finalFormat, {
|
|
639
654
|
selector: rule.selector,
|
|
640
655
|
candidate: original,
|
|
641
|
-
base: candidate.split(new RegExp(`\\${(
|
|
656
|
+
base: candidate.split(new RegExp(`\\${(ref1 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref1 !== void 0 ? ref1 : ":"}(?![^[]*\\])`)).pop(),
|
|
657
|
+
isArbitraryVariant: match[0].isArbitraryVariant,
|
|
642
658
|
context
|
|
643
659
|
});
|
|
644
660
|
});
|
|
645
|
-
|
|
661
|
+
match[1] = container.nodes[0];
|
|
646
662
|
}
|
|
647
|
-
yield
|
|
663
|
+
yield match;
|
|
648
664
|
}
|
|
649
665
|
}
|
|
650
666
|
}
|
|
@@ -714,5 +730,3 @@ function generateRules(candidates, context) {
|
|
|
714
730
|
function isArbitraryValue(input) {
|
|
715
731
|
return input.startsWith("[") && input.endsWith("]");
|
|
716
732
|
}
|
|
717
|
-
exports.resolveMatches = resolveMatches;
|
|
718
|
-
exports.generateRules = generateRules;
|
|
@@ -2,11 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>getModuleDependencies
|
|
8
|
+
});
|
|
9
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
10
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
11
|
+
const _resolve = /*#__PURE__*/ _interopRequireDefault(require("resolve"));
|
|
12
|
+
const _detective = /*#__PURE__*/ _interopRequireDefault(require("detective"));
|
|
13
|
+
function _interopRequireDefault(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function createModule(file) {
|
|
19
|
+
const source = _fs.default.readFileSync(file, "utf-8");
|
|
20
|
+
const requires = (0, _detective.default)(source);
|
|
21
|
+
return {
|
|
22
|
+
file,
|
|
23
|
+
requires
|
|
24
|
+
};
|
|
25
|
+
}
|
|
10
26
|
function getModuleDependencies(entryFile) {
|
|
11
27
|
const rootModule = createModule(entryFile);
|
|
12
28
|
const modules = [
|
|
@@ -33,16 +49,3 @@ function getModuleDependencies(entryFile) {
|
|
|
33
49
|
}
|
|
34
50
|
return modules;
|
|
35
51
|
}
|
|
36
|
-
function _interopRequireDefault(obj) {
|
|
37
|
-
return obj && obj.__esModule ? obj : {
|
|
38
|
-
default: obj
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function createModule(file) {
|
|
42
|
-
const source = _fs.default.readFileSync(file, "utf-8");
|
|
43
|
-
const requires = (0, _detective).default(source);
|
|
44
|
-
return {
|
|
45
|
-
file,
|
|
46
|
-
requires
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -2,8 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>normalizeTailwindDirectives
|
|
8
|
+
});
|
|
9
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
|
10
|
+
function _interopRequireDefault(obj) {
|
|
11
|
+
return obj && obj.__esModule ? obj : {
|
|
12
|
+
default: obj
|
|
13
|
+
};
|
|
14
|
+
}
|
|
7
15
|
function normalizeTailwindDirectives(root) {
|
|
8
16
|
let tailwindDirectives = new Set();
|
|
9
17
|
let layerDirectives = new Set();
|
|
@@ -77,8 +85,3 @@ function normalizeTailwindDirectives(root) {
|
|
|
77
85
|
applyDirectives
|
|
78
86
|
};
|
|
79
87
|
}
|
|
80
|
-
function _interopRequireDefault(obj) {
|
|
81
|
-
return obj && obj.__esModule ? obj : {
|
|
82
|
-
default: obj
|
|
83
|
-
};
|
|
84
|
-
}
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
}
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>expandApplyAtRules
|
|
8
|
+
});
|
|
11
9
|
function partitionRules(root) {
|
|
12
10
|
if (!root.walkAtRules) return;
|
|
13
11
|
let applyParents = new Set();
|
|
@@ -17,10 +15,10 @@ function partitionRules(root) {
|
|
|
17
15
|
if (applyParents.size === 0) {
|
|
18
16
|
return;
|
|
19
17
|
}
|
|
20
|
-
for (let
|
|
18
|
+
for (let rule of applyParents){
|
|
21
19
|
let nodeGroups = [];
|
|
22
20
|
let lastGroup = [];
|
|
23
|
-
for (let node of
|
|
21
|
+
for (let node of rule.nodes){
|
|
24
22
|
if (node.type === "atrule" && node.name === "apply") {
|
|
25
23
|
if (lastGroup.length > 0) {
|
|
26
24
|
nodeGroups.push(lastGroup);
|
|
@@ -42,12 +40,17 @@ function partitionRules(root) {
|
|
|
42
40
|
for (let group of [
|
|
43
41
|
...nodeGroups
|
|
44
42
|
].reverse()){
|
|
45
|
-
let clone =
|
|
43
|
+
let clone = rule.clone({
|
|
46
44
|
nodes: []
|
|
47
45
|
});
|
|
48
46
|
clone.append(group);
|
|
49
|
-
|
|
47
|
+
rule.after(clone);
|
|
50
48
|
}
|
|
51
|
-
|
|
49
|
+
rule.remove();
|
|
52
50
|
}
|
|
53
51
|
}
|
|
52
|
+
function expandApplyAtRules() {
|
|
53
|
+
return (root)=>{
|
|
54
|
+
partitionRules(root);
|
|
55
|
+
};
|
|
56
|
+
}
|
package/lib/lib/regex.js
CHANGED
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
pattern: ()=>pattern,
|
|
13
|
+
withoutCapturing: ()=>withoutCapturing,
|
|
14
|
+
any: ()=>any,
|
|
15
|
+
optional: ()=>optional,
|
|
16
|
+
zeroOrMore: ()=>zeroOrMore,
|
|
17
|
+
nestedBrackets: ()=>nestedBrackets,
|
|
18
|
+
escape: ()=>escape
|
|
19
|
+
});
|
|
12
20
|
const REGEX_SPECIAL = /[\\^$.*+?()[\]{}|]/g;
|
|
13
21
|
const REGEX_HAS_SPECIAL = RegExp(REGEX_SPECIAL.source);
|
|
14
22
|
/**
|