tailwindcss 3.3.1 → 3.3.2
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 +22 -6
- package/lib/cli/build/deps.js +17 -9
- package/lib/cli/build/index.js +10 -8
- package/lib/cli/build/plugin.js +27 -25
- package/lib/cli/build/utils.js +18 -8
- package/lib/cli/build/watching.js +12 -10
- package/lib/cli/help/index.js +6 -4
- package/lib/cli/index.js +4 -4
- package/lib/cli/init/index.js +8 -6
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +1 -1
- package/lib/corePluginList.js +3 -1
- package/lib/corePlugins.js +41 -35
- package/lib/featureFlags.js +14 -9
- package/lib/index.js +1 -5
- package/lib/lib/cacheInvalidation.js +7 -5
- package/lib/lib/collapseAdjacentRules.js +3 -1
- package/lib/lib/collapseDuplicateDeclarations.js +10 -8
- package/lib/lib/content.js +18 -14
- package/lib/lib/defaultExtractor.js +6 -4
- package/lib/lib/detectNesting.js +3 -1
- package/lib/lib/evaluateTailwindFunctions.js +18 -16
- package/lib/lib/expandApplyAtRules.js +37 -40
- package/lib/lib/expandTailwindAtRules.js +15 -13
- package/lib/lib/findAtConfigPath.js +6 -4
- package/lib/lib/generateRules.js +37 -31
- package/lib/lib/getModuleDependencies.js +10 -8
- package/lib/lib/load-config.js +5 -3
- package/lib/lib/normalizeTailwindDirectives.js +5 -3
- package/lib/lib/offsets.js +7 -5
- package/lib/lib/partitionApplyAtRules.js +3 -1
- package/lib/lib/regex.js +21 -7
- package/lib/lib/remap-bitfield.js +3 -1
- package/lib/lib/resolveDefaultsAtRules.js +24 -20
- package/lib/lib/setupContextUtils.js +67 -57
- package/lib/lib/setupTrackingContext.js +26 -24
- package/lib/lib/sharedState.js +28 -24
- package/lib/lib/substituteScreenAtRules.js +5 -3
- package/lib/oxide/cli/build/deps.js +16 -8
- package/lib/oxide/cli/build/index.js +6 -4
- package/lib/oxide/cli/build/plugin.js +19 -17
- package/lib/oxide/cli/build/utils.js +18 -8
- package/lib/oxide/cli/build/watching.js +10 -8
- package/lib/oxide/cli/help/index.js +6 -4
- package/lib/oxide/cli/index.js +4 -4
- package/lib/oxide/cli/init/index.js +6 -4
- package/lib/plugin.js +7 -7
- package/lib/postcss-plugins/nesting/index.js +3 -1
- package/lib/postcss-plugins/nesting/plugin.js +8 -6
- package/lib/processTailwindFeatures.js +14 -12
- package/lib/public/colors.js +5 -3
- package/lib/public/create-plugin.js +5 -3
- package/lib/public/default-config.js +6 -4
- package/lib/public/default-theme.js +6 -4
- package/lib/public/load-config.js +5 -3
- package/lib/public/resolve-config.js +6 -4
- package/lib/util/applyImportantSelector.js +9 -10
- package/lib/util/bigSign.js +3 -1
- package/lib/util/buildMediaQuery.js +3 -1
- package/lib/util/cloneDeep.js +3 -1
- package/lib/util/cloneNodes.js +3 -1
- package/lib/util/color.js +10 -6
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +3 -1
- package/lib/util/createPlugin.js +3 -1
- package/lib/util/createUtilityPlugin.js +5 -3
- package/lib/util/dataTypes.js +45 -15
- package/lib/util/defaults.js +6 -4
- package/lib/util/escapeClassName.js +7 -5
- package/lib/util/escapeCommas.js +3 -1
- package/lib/util/flattenColorPalette.js +3 -1
- package/lib/util/formatVariantSelector.js +28 -108
- package/lib/util/getAllConfigs.js +6 -4
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +3 -1
- package/lib/util/isPlainObject.js +3 -1
- package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
- package/lib/util/log.js +8 -4
- package/lib/util/nameClass.js +12 -6
- package/lib/util/negateValue.js +3 -1
- package/lib/util/normalizeConfig.js +7 -5
- package/lib/util/normalizeScreens.js +12 -4
- package/lib/util/parseAnimationValue.js +3 -1
- package/lib/util/parseBoxShadowValue.js +6 -2
- package/lib/util/parseDependency.js +3 -1
- package/lib/util/parseGlob.js +6 -4
- package/lib/util/parseObjectStyles.js +9 -7
- package/lib/util/pluginUtils.js +30 -18
- package/lib/util/prefixSelector.js +6 -4
- package/lib/util/pseudoElements.js +225 -0
- package/lib/util/removeAlphaVariables.js +3 -1
- package/lib/util/resolveConfig.js +10 -8
- package/lib/util/resolveConfigPath.js +9 -5
- package/lib/util/responsive.js +6 -4
- package/lib/util/splitAtTopLevelOnly.js +3 -1
- package/lib/util/tap.js +3 -1
- package/lib/util/toColorValue.js +3 -1
- package/lib/util/toPath.js +3 -1
- package/lib/util/transformThemeValue.js +6 -4
- package/lib/util/validateConfig.js +5 -3
- package/lib/util/validateFormalSyntax.js +3 -1
- package/lib/util/withAlphaVariable.js +6 -2
- package/package.json +30 -34
- package/peers/index.js +65828 -48819
- package/src/cli/build/plugin.js +1 -1
- package/src/cli.js +1 -1
- package/src/corePlugins.js +16 -17
- package/src/featureFlags.js +2 -3
- package/src/index.js +1 -5
- package/src/lib/defaultExtractor.js +1 -1
- package/src/lib/expandApplyAtRules.js +2 -8
- package/src/lib/expandTailwindAtRules.js +3 -3
- package/src/lib/setupTrackingContext.js +1 -1
- package/src/lib/sharedState.js +0 -15
- package/src/oxide/cli/build/plugin.ts +1 -1
- package/src/plugin.js +1 -1
- package/src/util/applyImportantSelector.js +2 -5
- package/src/util/color.js +1 -1
- package/src/util/colorNames.js +150 -0
- package/src/util/formatVariantSelector.js +2 -124
- package/src/util/pluginUtils.js +1 -5
- package/src/util/pseudoElements.js +170 -0
package/lib/lib/generateRules.js
CHANGED
|
@@ -9,27 +9,33 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getClassNameFromSelector: ()
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
getClassNameFromSelector: function() {
|
|
13
|
+
return getClassNameFromSelector;
|
|
14
|
+
},
|
|
15
|
+
resolveMatches: function() {
|
|
16
|
+
return resolveMatches;
|
|
17
|
+
},
|
|
18
|
+
generateRules: function() {
|
|
19
|
+
return generateRules;
|
|
20
|
+
}
|
|
15
21
|
});
|
|
16
|
-
const _postcss = /*#__PURE__*/
|
|
17
|
-
const
|
|
18
|
-
const _parseObjectStyles = /*#__PURE__*/
|
|
19
|
-
const _isPlainObject = /*#__PURE__*/
|
|
20
|
-
const _prefixSelector = /*#__PURE__*/
|
|
22
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
23
|
+
const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
|
|
24
|
+
const _parseObjectStyles = /*#__PURE__*/ _interop_require_default(require("../util/parseObjectStyles"));
|
|
25
|
+
const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("../util/isPlainObject"));
|
|
26
|
+
const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
|
|
21
27
|
const _pluginUtils = require("../util/pluginUtils");
|
|
22
|
-
const _log = /*#__PURE__*/
|
|
23
|
-
const _sharedState = /*#__PURE__*/
|
|
28
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
29
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
24
30
|
const _formatVariantSelector = require("../util/formatVariantSelector");
|
|
25
31
|
const _nameClass = require("../util/nameClass");
|
|
26
32
|
const _dataTypes = require("../util/dataTypes");
|
|
27
33
|
const _setupContextUtils = require("./setupContextUtils");
|
|
28
|
-
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/
|
|
29
|
-
const
|
|
34
|
+
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
|
|
35
|
+
const _splitAtTopLevelOnly = require("../util/splitAtTopLevelOnly.js");
|
|
30
36
|
const _featureFlags = require("../featureFlags");
|
|
31
37
|
const _applyImportantSelector = require("../util/applyImportantSelector");
|
|
32
|
-
function
|
|
38
|
+
function _interop_require_default(obj) {
|
|
33
39
|
return obj && obj.__esModule ? obj : {
|
|
34
40
|
default: obj
|
|
35
41
|
};
|
|
@@ -42,7 +48,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
42
48
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
43
49
|
})(nodeInterop);
|
|
44
50
|
}
|
|
45
|
-
function
|
|
51
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
46
52
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
47
53
|
return obj;
|
|
48
54
|
}
|
|
@@ -73,7 +79,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
73
79
|
}
|
|
74
80
|
return newObj;
|
|
75
81
|
}
|
|
76
|
-
let classNameParser = (0,
|
|
82
|
+
let classNameParser = (0, _postcssselectorparser.default)((selectors)=>{
|
|
77
83
|
return selectors.first.filter(({ type })=>type === "class").pop().value;
|
|
78
84
|
});
|
|
79
85
|
function getClassNameFromSelector(selector) {
|
|
@@ -163,7 +169,7 @@ function applyImportant(matches, classCandidate) {
|
|
|
163
169
|
]
|
|
164
170
|
});
|
|
165
171
|
container.walkRules((r)=>{
|
|
166
|
-
let ast = (0,
|
|
172
|
+
let ast = (0, _postcssselectorparser.default)().astSync(r.selector);
|
|
167
173
|
// Remove extraneous selectors that do not include the base candidate
|
|
168
174
|
ast.each((sel)=>(0, _formatVariantSelector.eliminateIrrelevantSelectors)(sel, classCandidate));
|
|
169
175
|
// Update all instances of the base candidate to include the important marker
|
|
@@ -199,7 +205,7 @@ function applyVariant(variant, matches, context) {
|
|
|
199
205
|
};
|
|
200
206
|
// Retrieve "modifier"
|
|
201
207
|
{
|
|
202
|
-
let [baseVariant, ...modifiers] = (0,
|
|
208
|
+
let [baseVariant, ...modifiers] = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(variant, "/");
|
|
203
209
|
// This is a hack to support variants with `/` in them, like `ar-1/10/20:text-red-500`
|
|
204
210
|
// In this case 1/10 is a value but /20 is a modifier
|
|
205
211
|
if (modifiers.length > 1) {
|
|
@@ -238,7 +244,7 @@ function applyVariant(variant, matches, context) {
|
|
|
238
244
|
if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
|
|
239
245
|
let sort = context.offsets.recordVariant(variant);
|
|
240
246
|
let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
|
|
241
|
-
let selectors = (0,
|
|
247
|
+
let selectors = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(selector, ",");
|
|
242
248
|
// We do not support multiple selectors for arbitrary variants
|
|
243
249
|
if (selectors.length > 1) {
|
|
244
250
|
return [];
|
|
@@ -320,14 +326,14 @@ function applyVariant(variant, matches, context) {
|
|
|
320
326
|
// It can happen that a list of format strings is returned from within the function. In that
|
|
321
327
|
// case, we have to process them as well. We can use the existing `variantSort`.
|
|
322
328
|
if (Array.isArray(ruleWithVariant)) {
|
|
323
|
-
for (let [idx,
|
|
329
|
+
for (let [idx, variantFunction] of ruleWithVariant.entries()){
|
|
324
330
|
// This is a little bit scary since we are pushing to an array of items that we are
|
|
325
331
|
// currently looping over. However, you can also think of it like a processing queue
|
|
326
332
|
// where you keep handling jobs until everything is done and each job can queue more
|
|
327
333
|
// jobs if needed.
|
|
328
334
|
variantFunctionTuples.push([
|
|
329
335
|
context.offsets.applyParallelOffset(variantSort, idx),
|
|
330
|
-
|
|
336
|
+
variantFunction,
|
|
331
337
|
// If the clone has been modified we have to pass that back
|
|
332
338
|
// though so each rule can use the modified container
|
|
333
339
|
clone.clone()
|
|
@@ -359,7 +365,7 @@ function applyVariant(variant, matches, context) {
|
|
|
359
365
|
// as well. E.g.: `${variant}${separator}${className}`.
|
|
360
366
|
// However, plugin authors probably also prepend or append certain
|
|
361
367
|
// classes, pseudos, ids, ...
|
|
362
|
-
let rebuiltBase = (0,
|
|
368
|
+
let rebuiltBase = (0, _postcssselectorparser.default)((selectors)=>{
|
|
363
369
|
selectors.walkClasses((classNode)=>{
|
|
364
370
|
classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
|
|
365
371
|
});
|
|
@@ -550,7 +556,7 @@ function splitWithSeparator(input, separator) {
|
|
|
550
556
|
_sharedState.NOT_ON_DEMAND
|
|
551
557
|
];
|
|
552
558
|
}
|
|
553
|
-
return (0,
|
|
559
|
+
return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, separator);
|
|
554
560
|
}
|
|
555
561
|
function* recordCandidates(matches, classCandidate) {
|
|
556
562
|
for (const match of matches){
|
|
@@ -575,7 +581,7 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
575
581
|
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping")) {
|
|
576
582
|
if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
|
|
577
583
|
let base = variants.slice().reverse().join(separator);
|
|
578
|
-
for (let part of (0,
|
|
584
|
+
for (let part of (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
|
|
579
585
|
yield* resolveMatches(base + separator + part, context, original);
|
|
580
586
|
}
|
|
581
587
|
}
|
|
@@ -617,18 +623,18 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
617
623
|
}
|
|
618
624
|
}
|
|
619
625
|
} else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
|
|
620
|
-
let
|
|
621
|
-
let [
|
|
622
|
-
for (let
|
|
626
|
+
let ruleSet = plugin;
|
|
627
|
+
let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
|
|
628
|
+
for (let rule of rules){
|
|
623
629
|
matchesPerPlugin.push([
|
|
624
630
|
{
|
|
625
631
|
...sort,
|
|
626
632
|
options: {
|
|
627
633
|
...sort.options,
|
|
628
|
-
...
|
|
634
|
+
...options
|
|
629
635
|
}
|
|
630
636
|
},
|
|
631
|
-
|
|
637
|
+
rule
|
|
632
638
|
]);
|
|
633
639
|
}
|
|
634
640
|
}
|
|
@@ -704,11 +710,11 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
704
710
|
}
|
|
705
711
|
let messages = [];
|
|
706
712
|
for (let [idx, group] of typesPerPlugin.entries()){
|
|
707
|
-
for (let
|
|
708
|
-
let
|
|
713
|
+
for (let type of group){
|
|
714
|
+
let rules = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
|
|
709
715
|
.map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
|
|
710
716
|
.join("\n")).join("\n\n");
|
|
711
|
-
messages.push(` Use \`${candidate.replace("[", `[${
|
|
717
|
+
messages.push(` Use \`${candidate.replace("[", `[${type}:`)}\` for \`${rules.trim()}\``);
|
|
712
718
|
break;
|
|
713
719
|
}
|
|
714
720
|
}
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return getModuleDependencies;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _fs = /*#__PURE__*/
|
|
10
|
-
const _path = /*#__PURE__*/
|
|
11
|
-
function
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
12
14
|
return obj && obj.__esModule ? obj : {
|
|
13
15
|
default: obj
|
|
14
16
|
};
|
|
@@ -59,10 +61,10 @@ function resolveWithExtension(file, extensions) {
|
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
// Try to find `./a/index.js` from `./a`
|
|
62
|
-
for (let
|
|
63
|
-
let
|
|
64
|
-
if (_fs.default.existsSync(
|
|
65
|
-
return
|
|
64
|
+
for (let ext of extensions){
|
|
65
|
+
let full = `${file}/index${ext}`;
|
|
66
|
+
if (_fs.default.existsSync(full)) {
|
|
67
|
+
return full;
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
return null;
|
package/lib/lib/load-config.js
CHANGED
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "loadConfig", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return loadConfig;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _jiti = /*#__PURE__*/
|
|
11
|
+
const _jiti = /*#__PURE__*/ _interop_require_default(require("jiti"));
|
|
10
12
|
const _sucrase = require("sucrase");
|
|
11
|
-
function
|
|
13
|
+
function _interop_require_default(obj) {
|
|
12
14
|
return obj && obj.__esModule ? obj : {
|
|
13
15
|
default: obj
|
|
14
16
|
};
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return normalizeTailwindDirectives;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _log = /*#__PURE__*/
|
|
10
|
-
function
|
|
11
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
11
13
|
return obj && obj.__esModule ? obj : {
|
|
12
14
|
default: obj
|
|
13
15
|
};
|
package/lib/lib/offsets.js
CHANGED
|
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "Offsets", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: ()
|
|
8
|
+
get: function() {
|
|
9
|
+
return Offsets;
|
|
10
|
+
}
|
|
9
11
|
});
|
|
10
|
-
const _bigSign = /*#__PURE__*/
|
|
11
|
-
const
|
|
12
|
-
function
|
|
12
|
+
const _bigSign = /*#__PURE__*/ _interop_require_default(require("../util/bigSign"));
|
|
13
|
+
const _remapbitfield = require("./remap-bitfield.js");
|
|
14
|
+
function _interop_require_default(obj) {
|
|
13
15
|
return obj && obj.__esModule ? obj : {
|
|
14
16
|
default: obj
|
|
15
17
|
};
|
|
@@ -253,7 +255,7 @@ class Offsets {
|
|
|
253
255
|
let [offset, rule] = item;
|
|
254
256
|
offset = {
|
|
255
257
|
...offset,
|
|
256
|
-
variants: (0,
|
|
258
|
+
variants: (0, _remapbitfield.remapBitfield)(offset.variants, mapping)
|
|
257
259
|
};
|
|
258
260
|
return [
|
|
259
261
|
offset,
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return expandApplyAtRules;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
function partitionRules(root) {
|
|
10
12
|
if (!root.walkAtRules) return;
|
package/lib/lib/regex.js
CHANGED
|
@@ -9,13 +9,27 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
pattern: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
pattern: function() {
|
|
13
|
+
return pattern;
|
|
14
|
+
},
|
|
15
|
+
withoutCapturing: function() {
|
|
16
|
+
return withoutCapturing;
|
|
17
|
+
},
|
|
18
|
+
any: function() {
|
|
19
|
+
return any;
|
|
20
|
+
},
|
|
21
|
+
optional: function() {
|
|
22
|
+
return optional;
|
|
23
|
+
},
|
|
24
|
+
zeroOrMore: function() {
|
|
25
|
+
return zeroOrMore;
|
|
26
|
+
},
|
|
27
|
+
nestedBrackets: function() {
|
|
28
|
+
return nestedBrackets;
|
|
29
|
+
},
|
|
30
|
+
escape: function() {
|
|
31
|
+
return escape;
|
|
32
|
+
}
|
|
19
33
|
});
|
|
20
34
|
const REGEX_SPECIAL = /[\\^$.*+?()[\]{}|]/g;
|
|
21
35
|
const REGEX_HAS_SPECIAL = RegExp(REGEX_SPECIAL.source);
|
|
@@ -69,7 +69,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "remapBitfield", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: ()
|
|
72
|
+
get: function() {
|
|
73
|
+
return remapBitfield;
|
|
74
|
+
}
|
|
73
75
|
});
|
|
74
76
|
function remapBitfield(num, mapping) {
|
|
75
77
|
// Create masks for the old and new bits that are set
|
|
@@ -9,20 +9,24 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
elementSelectorParser: ()
|
|
13
|
-
|
|
12
|
+
elementSelectorParser: function() {
|
|
13
|
+
return elementSelectorParser;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return resolveDefaultsAtRules;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const _postcss = /*#__PURE__*/
|
|
16
|
-
const
|
|
19
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
20
|
+
const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
|
|
17
21
|
const _featureFlags = require("../featureFlags");
|
|
18
|
-
function
|
|
22
|
+
function _interop_require_default(obj) {
|
|
19
23
|
return obj && obj.__esModule ? obj : {
|
|
20
24
|
default: obj
|
|
21
25
|
};
|
|
22
26
|
}
|
|
23
27
|
let getNode = {
|
|
24
28
|
id (node) {
|
|
25
|
-
return
|
|
29
|
+
return _postcssselectorparser.default.attribute({
|
|
26
30
|
attribute: "id",
|
|
27
31
|
operator: "=",
|
|
28
32
|
value: node.value,
|
|
@@ -60,14 +64,14 @@ function minimumImpactSelector(nodes) {
|
|
|
60
64
|
let combinatorIdx = rest.findIndex((n)=>n.type === "combinator" && n.value === ">");
|
|
61
65
|
if (combinatorIdx !== -1) {
|
|
62
66
|
rest.splice(0, combinatorIdx);
|
|
63
|
-
rest.unshift(
|
|
67
|
+
rest.unshift(_postcssselectorparser.default.universal());
|
|
64
68
|
}
|
|
65
69
|
return [
|
|
66
70
|
bestNode,
|
|
67
71
|
...rest.reverse()
|
|
68
72
|
].join("").trim();
|
|
69
73
|
}
|
|
70
|
-
let elementSelectorParser = (0,
|
|
74
|
+
let elementSelectorParser = (0, _postcssselectorparser.default)((selectors)=>{
|
|
71
75
|
return selectors.map((s)=>{
|
|
72
76
|
let nodes = s.split((n)=>n.type === "combinator" && n.value === " ").pop();
|
|
73
77
|
return minimumImpactSelector(nodes);
|
|
@@ -119,12 +123,12 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
119
123
|
universal.remove();
|
|
120
124
|
continue;
|
|
121
125
|
}
|
|
122
|
-
for (let [,
|
|
126
|
+
for (let [, selectors] of selectorGroups){
|
|
123
127
|
let universalRule = _postcss.default.rule({
|
|
124
128
|
source: universal.source
|
|
125
129
|
});
|
|
126
130
|
universalRule.selectors = [
|
|
127
|
-
...
|
|
131
|
+
...selectors
|
|
128
132
|
];
|
|
129
133
|
universalRule.append(universal.nodes.map((node)=>node.clone()));
|
|
130
134
|
universal.before(universalRule);
|
|
@@ -133,29 +137,29 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
133
137
|
universal.remove();
|
|
134
138
|
}
|
|
135
139
|
} else if (universals.size) {
|
|
136
|
-
let
|
|
140
|
+
let universalRule = _postcss.default.rule({
|
|
137
141
|
selectors: [
|
|
138
142
|
"*",
|
|
139
143
|
"::before",
|
|
140
144
|
"::after"
|
|
141
145
|
]
|
|
142
146
|
});
|
|
143
|
-
for (let
|
|
144
|
-
|
|
145
|
-
if (!
|
|
146
|
-
|
|
147
|
+
for (let universal of universals){
|
|
148
|
+
universalRule.append(universal.nodes);
|
|
149
|
+
if (!universalRule.parent) {
|
|
150
|
+
universal.before(universalRule);
|
|
147
151
|
}
|
|
148
|
-
if (!
|
|
149
|
-
|
|
152
|
+
if (!universalRule.source) {
|
|
153
|
+
universalRule.source = universal.source;
|
|
150
154
|
}
|
|
151
|
-
|
|
155
|
+
universal.remove();
|
|
152
156
|
}
|
|
153
|
-
let backdropRule =
|
|
157
|
+
let backdropRule = universalRule.clone({
|
|
154
158
|
selectors: [
|
|
155
159
|
"::backdrop"
|
|
156
160
|
]
|
|
157
161
|
});
|
|
158
|
-
|
|
162
|
+
universalRule.after(backdropRule);
|
|
159
163
|
}
|
|
160
164
|
};
|
|
161
165
|
}
|