tailwindcss 0.0.0-insiders.ed024ee → 0.0.0-insiders.ed3c535
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/README.md +3 -3
- package/lib/cli/build/plugin.js +3 -1
- package/lib/corePlugins.js +20 -9
- package/lib/lib/content.js +66 -0
- package/lib/lib/defaultExtractor.js +23 -1
- package/lib/lib/expandTailwindAtRules.js +2 -2
- package/lib/lib/load-config.js +4 -0
- package/lib/lib/resolveDefaultsAtRules.js +13 -15
- package/lib/util/applyImportantSelector.js +5 -3
- package/lib/util/dataTypes.js +31 -2
- package/lib/util/normalizeConfig.js +1 -2
- package/lib/util/parseAnimationValue.js +1 -1
- package/lib/util/parseGlob.js +1 -2
- package/lib/util/resolveConfigPath.js +3 -1
- package/lib/util/splitAtTopLevelOnly.js +1 -5
- package/package.json +2 -2
- package/peers/index.js +3896 -2545
- package/src/cli/build/plugin.js +6 -2
- package/src/corePlugins.js +32 -15
- package/src/lib/content.js +87 -0
- package/src/lib/defaultExtractor.js +26 -1
- package/src/lib/expandTailwindAtRules.js +1 -1
- package/src/lib/load-config.ts +11 -0
- package/src/lib/resolveDefaultsAtRules.js +11 -13
- package/src/util/applyImportantSelector.js +5 -6
- package/src/util/dataTypes.js +36 -0
- package/src/util/normalizeConfig.js +1 -3
- package/src/util/parseAnimationValue.js +1 -1
- package/src/util/parseGlob.js +1 -2
- package/src/util/resolveConfigPath.js +2 -0
- package/src/util/splitAtTopLevelOnly.js +1 -5
- package/stubs/config.full.js +1 -1
package/README.md
CHANGED
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
-
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=
|
|
16
|
+
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=main" alt="Build Status"></a>
|
|
17
17
|
<a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
|
|
18
18
|
<a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
|
|
19
|
-
<a href="https://github.com/tailwindcss/tailwindcss/blob/
|
|
19
|
+
<a href="https://github.com/tailwindcss/tailwindcss/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
|
|
20
20
|
</p>
|
|
21
21
|
|
|
22
22
|
---
|
|
@@ -37,4 +37,4 @@ For casual chit-chat with others using the framework:
|
|
|
37
37
|
|
|
38
38
|
## Contributing
|
|
39
39
|
|
|
40
|
-
If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/
|
|
40
|
+
If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/main/.github/CONTRIBUTING.md) **before submitting a pull request**.
|
package/lib/cli/build/plugin.js
CHANGED
|
@@ -166,7 +166,9 @@ let state = {
|
|
|
166
166
|
// Resolve globs from the content config
|
|
167
167
|
// TODO: When we make the postcss plugin async-capable this can become async
|
|
168
168
|
let files = _fastglob.default.sync(this.contentPatterns.all);
|
|
169
|
+
let checkBroadPattern = (0, _content.createBroadPatternCheck)(this.contentPatterns.all);
|
|
169
170
|
for (let file of files){
|
|
171
|
+
checkBroadPattern(file);
|
|
170
172
|
content.push({
|
|
171
173
|
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
172
174
|
extension: _path.default.extname(file).slice(1)
|
|
@@ -277,7 +279,7 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
277
279
|
if (input) {
|
|
278
280
|
return _fs.default.promises.readFile(_path.default.resolve(input), "utf8");
|
|
279
281
|
}
|
|
280
|
-
// No input file provided, fallback to default
|
|
282
|
+
// No input file provided, fallback to default at-rules
|
|
281
283
|
return "@tailwind base; @tailwind components; @tailwind utilities";
|
|
282
284
|
}
|
|
283
285
|
async function build() {
|
package/lib/corePlugins.js
CHANGED
|
@@ -443,7 +443,7 @@ let variantPlugins = {
|
|
|
443
443
|
matchVariant("supports", (value = "")=>{
|
|
444
444
|
let check = (0, _dataTypes.normalize)(value);
|
|
445
445
|
let isRaw = /^\w*\s*\(/.test(check);
|
|
446
|
-
// Chrome has a bug where `(
|
|
446
|
+
// Chrome has a bug where `(condition1)or(condition2)` is not valid
|
|
447
447
|
// But `(condition1) or (condition2)` is supported.
|
|
448
448
|
check = isRaw ? check.replace(/\b(and|or|not)\b/g, " $1 ") : check;
|
|
449
449
|
if (isRaw) {
|
|
@@ -482,29 +482,29 @@ let variantPlugins = {
|
|
|
482
482
|
},
|
|
483
483
|
ariaVariants: ({ matchVariant , theme })=>{
|
|
484
484
|
var _theme;
|
|
485
|
-
matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
|
|
485
|
+
matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}]`, {
|
|
486
486
|
values: (_theme = theme("aria")) !== null && _theme !== void 0 ? _theme : {}
|
|
487
487
|
});
|
|
488
488
|
var _theme1;
|
|
489
|
-
matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[aria-${(0, _dataTypes.normalize)(value)}] &`, {
|
|
489
|
+
matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] &` : `:merge(.group)[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] &`, {
|
|
490
490
|
values: (_theme1 = theme("aria")) !== null && _theme1 !== void 0 ? _theme1 : {}
|
|
491
491
|
});
|
|
492
492
|
var _theme2;
|
|
493
|
-
matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[aria-${(0, _dataTypes.normalize)(value)}] ~ &`, {
|
|
493
|
+
matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] ~ &` : `:merge(.peer)[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] ~ &`, {
|
|
494
494
|
values: (_theme2 = theme("aria")) !== null && _theme2 !== void 0 ? _theme2 : {}
|
|
495
495
|
});
|
|
496
496
|
},
|
|
497
497
|
dataVariants: ({ matchVariant , theme })=>{
|
|
498
498
|
var _theme;
|
|
499
|
-
matchVariant("data", (value)=>`&[data-${(0, _dataTypes.normalize)(value)}]`, {
|
|
499
|
+
matchVariant("data", (value)=>`&[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}]`, {
|
|
500
500
|
values: (_theme = theme("data")) !== null && _theme !== void 0 ? _theme : {}
|
|
501
501
|
});
|
|
502
502
|
var _theme1;
|
|
503
|
-
matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[data-${(0, _dataTypes.normalize)(value)}] &`, {
|
|
503
|
+
matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] &` : `:merge(.group)[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] &`, {
|
|
504
504
|
values: (_theme1 = theme("data")) !== null && _theme1 !== void 0 ? _theme1 : {}
|
|
505
505
|
});
|
|
506
506
|
var _theme2;
|
|
507
|
-
matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[data-${(0, _dataTypes.normalize)(value)}] ~ &`, {
|
|
507
|
+
matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] ~ &` : `:merge(.peer)[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] ~ &`, {
|
|
508
508
|
values: (_theme2 = theme("data")) !== null && _theme2 !== void 0 ? _theme2 : {}
|
|
509
509
|
});
|
|
510
510
|
},
|
|
@@ -3929,7 +3929,7 @@ let corePlugins = {
|
|
|
3929
3929
|
matchUtilities({
|
|
3930
3930
|
blur: (value)=>{
|
|
3931
3931
|
return {
|
|
3932
|
-
"--tw-blur": `blur(${value})`,
|
|
3932
|
+
"--tw-blur": value.trim() === "" ? " " : `blur(${value})`,
|
|
3933
3933
|
"@defaults filter": {},
|
|
3934
3934
|
filter: cssFilterValue
|
|
3935
3935
|
};
|
|
@@ -4069,8 +4069,9 @@ let corePlugins = {
|
|
|
4069
4069
|
matchUtilities({
|
|
4070
4070
|
"backdrop-blur": (value)=>{
|
|
4071
4071
|
return {
|
|
4072
|
-
"--tw-backdrop-blur": `blur(${value})`,
|
|
4072
|
+
"--tw-backdrop-blur": value.trim() === "" ? " " : `blur(${value})`,
|
|
4073
4073
|
"@defaults backdrop-filter": {},
|
|
4074
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4074
4075
|
"backdrop-filter": cssBackdropFilterValue
|
|
4075
4076
|
};
|
|
4076
4077
|
}
|
|
@@ -4084,6 +4085,7 @@ let corePlugins = {
|
|
|
4084
4085
|
return {
|
|
4085
4086
|
"--tw-backdrop-brightness": `brightness(${value})`,
|
|
4086
4087
|
"@defaults backdrop-filter": {},
|
|
4088
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4087
4089
|
"backdrop-filter": cssBackdropFilterValue
|
|
4088
4090
|
};
|
|
4089
4091
|
}
|
|
@@ -4097,6 +4099,7 @@ let corePlugins = {
|
|
|
4097
4099
|
return {
|
|
4098
4100
|
"--tw-backdrop-contrast": `contrast(${value})`,
|
|
4099
4101
|
"@defaults backdrop-filter": {},
|
|
4102
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4100
4103
|
"backdrop-filter": cssBackdropFilterValue
|
|
4101
4104
|
};
|
|
4102
4105
|
}
|
|
@@ -4110,6 +4113,7 @@ let corePlugins = {
|
|
|
4110
4113
|
return {
|
|
4111
4114
|
"--tw-backdrop-grayscale": `grayscale(${value})`,
|
|
4112
4115
|
"@defaults backdrop-filter": {},
|
|
4116
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4113
4117
|
"backdrop-filter": cssBackdropFilterValue
|
|
4114
4118
|
};
|
|
4115
4119
|
}
|
|
@@ -4123,6 +4127,7 @@ let corePlugins = {
|
|
|
4123
4127
|
return {
|
|
4124
4128
|
"--tw-backdrop-hue-rotate": `hue-rotate(${value})`,
|
|
4125
4129
|
"@defaults backdrop-filter": {},
|
|
4130
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4126
4131
|
"backdrop-filter": cssBackdropFilterValue
|
|
4127
4132
|
};
|
|
4128
4133
|
}
|
|
@@ -4137,6 +4142,7 @@ let corePlugins = {
|
|
|
4137
4142
|
return {
|
|
4138
4143
|
"--tw-backdrop-invert": `invert(${value})`,
|
|
4139
4144
|
"@defaults backdrop-filter": {},
|
|
4145
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4140
4146
|
"backdrop-filter": cssBackdropFilterValue
|
|
4141
4147
|
};
|
|
4142
4148
|
}
|
|
@@ -4150,6 +4156,7 @@ let corePlugins = {
|
|
|
4150
4156
|
return {
|
|
4151
4157
|
"--tw-backdrop-opacity": `opacity(${value})`,
|
|
4152
4158
|
"@defaults backdrop-filter": {},
|
|
4159
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4153
4160
|
"backdrop-filter": cssBackdropFilterValue
|
|
4154
4161
|
};
|
|
4155
4162
|
}
|
|
@@ -4163,6 +4170,7 @@ let corePlugins = {
|
|
|
4163
4170
|
return {
|
|
4164
4171
|
"--tw-backdrop-saturate": `saturate(${value})`,
|
|
4165
4172
|
"@defaults backdrop-filter": {},
|
|
4173
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4166
4174
|
"backdrop-filter": cssBackdropFilterValue
|
|
4167
4175
|
};
|
|
4168
4176
|
}
|
|
@@ -4176,6 +4184,7 @@ let corePlugins = {
|
|
|
4176
4184
|
return {
|
|
4177
4185
|
"--tw-backdrop-sepia": `sepia(${value})`,
|
|
4178
4186
|
"@defaults backdrop-filter": {},
|
|
4187
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4179
4188
|
"backdrop-filter": cssBackdropFilterValue
|
|
4180
4189
|
};
|
|
4181
4190
|
}
|
|
@@ -4198,9 +4207,11 @@ let corePlugins = {
|
|
|
4198
4207
|
addUtilities({
|
|
4199
4208
|
".backdrop-filter": {
|
|
4200
4209
|
"@defaults backdrop-filter": {},
|
|
4210
|
+
"-webkit-backdrop-filter": cssBackdropFilterValue,
|
|
4201
4211
|
"backdrop-filter": cssBackdropFilterValue
|
|
4202
4212
|
},
|
|
4203
4213
|
".backdrop-filter-none": {
|
|
4214
|
+
"-webkit-backdrop-filter": "none",
|
|
4204
4215
|
"backdrop-filter": "none"
|
|
4205
4216
|
}
|
|
4206
4217
|
});
|
package/lib/lib/content.js
CHANGED
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
|
15
15
|
},
|
|
16
16
|
resolvedChangedContent: function() {
|
|
17
17
|
return resolvedChangedContent;
|
|
18
|
+
},
|
|
19
|
+
createBroadPatternCheck: function() {
|
|
20
|
+
return createBroadPatternCheck;
|
|
18
21
|
}
|
|
19
22
|
});
|
|
20
23
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
@@ -24,6 +27,8 @@ const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
|
|
|
24
27
|
const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
|
|
25
28
|
const _parseGlob = require("../util/parseGlob");
|
|
26
29
|
const _sharedState = require("./sharedState");
|
|
30
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
31
|
+
const _micromatch = /*#__PURE__*/ _interop_require_default(require("micromatch"));
|
|
27
32
|
function _interop_require_default(obj) {
|
|
28
33
|
return obj && obj.__esModule ? obj : {
|
|
29
34
|
default: obj
|
|
@@ -152,6 +157,65 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
152
157
|
mTimesToCommit
|
|
153
158
|
];
|
|
154
159
|
}
|
|
160
|
+
const LARGE_DIRECTORIES = [
|
|
161
|
+
"node_modules"
|
|
162
|
+
];
|
|
163
|
+
// Ensures that `node_modules` has to match as-is, otherwise `mynode_modules`
|
|
164
|
+
// would match as well, but that is not a known large directory.
|
|
165
|
+
const LARGE_DIRECTORIES_REGEX = new RegExp(`(${LARGE_DIRECTORIES.map((dir)=>String.raw`\b${dir}\b`).join("|")})`);
|
|
166
|
+
function createBroadPatternCheck(paths) {
|
|
167
|
+
// Detect whether a glob pattern might be too broad. This means that it:
|
|
168
|
+
// - Includes `**`
|
|
169
|
+
// - Does not include any of the known large directories (e.g.: node_modules)
|
|
170
|
+
let maybeBroadPattern = paths.some((path)=>path.includes("**") && !LARGE_DIRECTORIES_REGEX.test(path));
|
|
171
|
+
// Didn't detect any potentially broad patterns, so we can skip further
|
|
172
|
+
// checks.
|
|
173
|
+
if (!maybeBroadPattern) {
|
|
174
|
+
return ()=>{};
|
|
175
|
+
}
|
|
176
|
+
// All glob matchers
|
|
177
|
+
let matchers = [];
|
|
178
|
+
// All glob matchers that explicitly contain any of the known large
|
|
179
|
+
// directories (e.g.: node_modules).
|
|
180
|
+
let explicitMatchers = [];
|
|
181
|
+
// Create matchers for all paths
|
|
182
|
+
for (let path of paths){
|
|
183
|
+
let matcher = _micromatch.default.matcher(path);
|
|
184
|
+
if (LARGE_DIRECTORIES_REGEX.test(path)) {
|
|
185
|
+
explicitMatchers.push(matcher);
|
|
186
|
+
}
|
|
187
|
+
matchers.push(matcher);
|
|
188
|
+
}
|
|
189
|
+
// Keep track of whether we already warned about the broad pattern issue or
|
|
190
|
+
// not. The `log.warn` function already does something similar where we only
|
|
191
|
+
// output the log once. However, with this we can also skip the other checks
|
|
192
|
+
// when we already warned about the broad pattern.
|
|
193
|
+
let warned = false;
|
|
194
|
+
/**
|
|
195
|
+
* @param {string} file
|
|
196
|
+
*/ return (file)=>{
|
|
197
|
+
if (warned) return; // Already warned about the broad pattern
|
|
198
|
+
if (explicitMatchers.some((matcher)=>matcher(file))) return; // Explicitly included, so we can skip further checks
|
|
199
|
+
// When a broad pattern is used, we have to double check that the file was
|
|
200
|
+
// not explicitly included in the globs.
|
|
201
|
+
let matchingGlobIndex = matchers.findIndex((matcher)=>matcher(file));
|
|
202
|
+
if (matchingGlobIndex === -1) return; // This should never happen
|
|
203
|
+
let matchingGlob = paths[matchingGlobIndex];
|
|
204
|
+
// Create relative paths to make the output a bit more readable.
|
|
205
|
+
let relativeMatchingGlob = _path.default.relative(process.cwd(), matchingGlob);
|
|
206
|
+
if (relativeMatchingGlob[0] !== ".") relativeMatchingGlob = `./${relativeMatchingGlob}`;
|
|
207
|
+
let largeDirectory = LARGE_DIRECTORIES.find((directory)=>file.includes(directory));
|
|
208
|
+
if (largeDirectory) {
|
|
209
|
+
warned = true;
|
|
210
|
+
_log.default.warn("broad-content-glob-pattern", [
|
|
211
|
+
`Your \`content\` configuration includes a pattern which looks like it's accidentally matching all of \`${largeDirectory}\` and can cause serious performance issues.`,
|
|
212
|
+
`Pattern: \`${relativeMatchingGlob}\``,
|
|
213
|
+
`See our documentation for recommendations:`,
|
|
214
|
+
"https://tailwindcss.com/docs/content-configuration#pattern-recommendations"
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
155
219
|
/**
|
|
156
220
|
*
|
|
157
221
|
* @param {ContentPath[]} candidateFiles
|
|
@@ -160,12 +224,14 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
160
224
|
*/ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
161
225
|
let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
|
|
162
226
|
let mTimesToCommit = new Map();
|
|
227
|
+
let checkBroadPattern = createBroadPatternCheck(paths);
|
|
163
228
|
let changedFiles = new Set();
|
|
164
229
|
_sharedState.env.DEBUG && console.time("Finding changed files");
|
|
165
230
|
let files = _fastglob.default.sync(paths, {
|
|
166
231
|
absolute: true
|
|
167
232
|
});
|
|
168
233
|
for (let file of files){
|
|
234
|
+
checkBroadPattern(file);
|
|
169
235
|
let prevModified = fileModifiedMap.get(file) || -Infinity;
|
|
170
236
|
let modified = _fs.default.statSync(file).mtimeMs;
|
|
171
237
|
if (modified > prevModified) {
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "defaultExtractor", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
|
|
12
|
+
const _splitAtTopLevelOnly = require("../util/splitAtTopLevelOnly");
|
|
12
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
13
14
|
if (typeof WeakMap !== "function") return null;
|
|
14
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -60,6 +61,27 @@ function defaultExtractor(context) {
|
|
|
60
61
|
results.push(clipAtBalancedParens(result));
|
|
61
62
|
}
|
|
62
63
|
}
|
|
64
|
+
// Extract any subclasses from languages like Slim and Pug, eg:
|
|
65
|
+
// div.flex.px-5.underline
|
|
66
|
+
for (let result of results.slice()){
|
|
67
|
+
let segments = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(result, ".");
|
|
68
|
+
for(let idx = 0; idx < segments.length; idx++){
|
|
69
|
+
let segment = segments[idx];
|
|
70
|
+
if (idx >= segments.length - 1) {
|
|
71
|
+
results.push(segment);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
// If the next segment is a number, discard both, for example seeing
|
|
75
|
+
// `px-1` and `5` means the real candidate was `px-1.5` which is already
|
|
76
|
+
// captured.
|
|
77
|
+
let next = Number(segments[idx + 1]);
|
|
78
|
+
if (isNaN(next)) {
|
|
79
|
+
results.push(segment);
|
|
80
|
+
} else {
|
|
81
|
+
idx++;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
63
85
|
return results;
|
|
64
86
|
};
|
|
65
87
|
}
|
|
@@ -170,7 +192,7 @@ function* buildRegExps(context) {
|
|
|
170
192
|
]);
|
|
171
193
|
}
|
|
172
194
|
// 5. Inner matches
|
|
173
|
-
yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
|
|
195
|
+
yield /[^<>"'`\s.(){}[\]#=%$][^<>"'`\s(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
|
|
174
196
|
}
|
|
175
197
|
// We want to capture any "special" characters
|
|
176
198
|
// AND the characters immediately following them (if there is one)
|
|
@@ -203,8 +203,8 @@ function expandTailwindAtRules(context) {
|
|
|
203
203
|
// Replace any Tailwind directives with generated CSS
|
|
204
204
|
if (layerNodes.base) {
|
|
205
205
|
layerNodes.base.before((0, _cloneNodes.default)([
|
|
206
|
-
...
|
|
207
|
-
...
|
|
206
|
+
...defaultNodes,
|
|
207
|
+
...baseNodes
|
|
208
208
|
], layerNodes.base.source, {
|
|
209
209
|
layer: "base"
|
|
210
210
|
}));
|
package/lib/lib/load-config.js
CHANGED
|
@@ -46,6 +46,10 @@ function lazyJiti() {
|
|
|
46
46
|
}
|
|
47
47
|
function loadConfig(path) {
|
|
48
48
|
let config = function() {
|
|
49
|
+
// Always use jiti for ESM or TS files
|
|
50
|
+
if (path && (path.endsWith(".mjs") || path.endsWith(".ts") || path.endsWith(".cts") || path.endsWith(".mts"))) {
|
|
51
|
+
return lazyJiti()(path);
|
|
52
|
+
}
|
|
49
53
|
try {
|
|
50
54
|
return path ? require(path) : {};
|
|
51
55
|
} catch {
|
|
@@ -120,21 +120,19 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
120
120
|
selectors.add(selector);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
universal.before(universalRule);
|
|
137
|
-
}
|
|
123
|
+
if (selectorGroups.size === 0) {
|
|
124
|
+
universal.remove();
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
for (let [, selectors] of selectorGroups){
|
|
128
|
+
let universalRule = _postcss.default.rule({
|
|
129
|
+
source: universal.source
|
|
130
|
+
});
|
|
131
|
+
universalRule.selectors = [
|
|
132
|
+
...selectors
|
|
133
|
+
];
|
|
134
|
+
universalRule.append(universal.nodes.map((node)=>node.clone()));
|
|
135
|
+
universal.before(universalRule);
|
|
138
136
|
}
|
|
139
137
|
universal.remove();
|
|
140
138
|
}
|
|
@@ -18,9 +18,11 @@ function _interop_require_default(obj) {
|
|
|
18
18
|
function applyImportantSelector(selector, important) {
|
|
19
19
|
let sel = (0, _postcssselectorparser.default)().astSync(selector);
|
|
20
20
|
sel.each((sel)=>{
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// For nesting, we only need to wrap a selector with :is() if it has a top-level combinator,
|
|
22
|
+
// e.g. `.dark .text-white`, to be independent of DOM order. Any other selector, including
|
|
23
|
+
// combinators inside of pseudos like `:where()`, are ok to nest.
|
|
24
|
+
let shouldWrap = sel.nodes.some((node)=>node.type === "combinator");
|
|
25
|
+
if (shouldWrap) {
|
|
24
26
|
sel.nodes = [
|
|
25
27
|
_postcssselectorparser.default.pseudo({
|
|
26
28
|
value: ":is",
|
package/lib/util/dataTypes.js
CHANGED
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
|
12
12
|
normalize: function() {
|
|
13
13
|
return normalize;
|
|
14
14
|
},
|
|
15
|
+
normalizeAttributeSelectors: function() {
|
|
16
|
+
return normalizeAttributeSelectors;
|
|
17
|
+
},
|
|
15
18
|
url: function() {
|
|
16
19
|
return url;
|
|
17
20
|
},
|
|
@@ -77,6 +80,7 @@ function isCSSFunction(value) {
|
|
|
77
80
|
// More info:
|
|
78
81
|
// - https://drafts.csswg.org/scroll-animations/#propdef-timeline-scope
|
|
79
82
|
// - https://developer.mozilla.org/en-US/docs/Web/CSS/timeline-scope#dashed-ident
|
|
83
|
+
// - https://www.w3.org/TR/css-anchor-position-1
|
|
80
84
|
//
|
|
81
85
|
const AUTO_VAR_INJECTION_EXCEPTIONS = new Set([
|
|
82
86
|
// Concrete properties
|
|
@@ -84,10 +88,15 @@ const AUTO_VAR_INJECTION_EXCEPTIONS = new Set([
|
|
|
84
88
|
"timeline-scope",
|
|
85
89
|
"view-timeline-name",
|
|
86
90
|
"font-palette",
|
|
91
|
+
"anchor-name",
|
|
92
|
+
"anchor-scope",
|
|
93
|
+
"position-anchor",
|
|
94
|
+
"position-try-options",
|
|
87
95
|
// Shorthand properties
|
|
88
96
|
"scroll-timeline",
|
|
89
97
|
"animation-timeline",
|
|
90
|
-
"view-timeline"
|
|
98
|
+
"view-timeline",
|
|
99
|
+
"position-try"
|
|
91
100
|
]);
|
|
92
101
|
function normalize(value, context = null, isRoot = true) {
|
|
93
102
|
let isVarException = context && AUTO_VAR_INJECTION_EXCEPTIONS.has(context.property);
|
|
@@ -112,6 +121,25 @@ function normalize(value, context = null, isRoot = true) {
|
|
|
112
121
|
value = normalizeMathOperatorSpacing(value);
|
|
113
122
|
return value;
|
|
114
123
|
}
|
|
124
|
+
function normalizeAttributeSelectors(value) {
|
|
125
|
+
// Wrap values in attribute selectors with quotes
|
|
126
|
+
if (value.includes("=")) {
|
|
127
|
+
value = value.replace(/(=.*)/g, (_fullMatch, match)=>{
|
|
128
|
+
if (match[1] === "'" || match[1] === '"') {
|
|
129
|
+
return match;
|
|
130
|
+
}
|
|
131
|
+
// Handle regex flags on unescaped values
|
|
132
|
+
if (match.length > 2) {
|
|
133
|
+
let trailingCharacter = match[match.length - 1];
|
|
134
|
+
if (match[match.length - 2] === " " && (trailingCharacter === "i" || trailingCharacter === "I" || trailingCharacter === "s" || trailingCharacter === "S")) {
|
|
135
|
+
return `="${match.slice(1, -2)}" ${match[match.length - 1]}`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return `="${match.slice(1)}"`;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
115
143
|
/**
|
|
116
144
|
* Add spaces around operators inside math functions
|
|
117
145
|
* like calc() that do not follow an operator, '(', or `,`.
|
|
@@ -146,7 +174,8 @@ function normalize(value, context = null, isRoot = true) {
|
|
|
146
174
|
"conic-gradient",
|
|
147
175
|
"repeating-radial-gradient",
|
|
148
176
|
"repeating-linear-gradient",
|
|
149
|
-
"repeating-conic-gradient"
|
|
177
|
+
"repeating-conic-gradient",
|
|
178
|
+
"anchor-size"
|
|
150
179
|
];
|
|
151
180
|
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
|
|
152
181
|
let result = "";
|
|
@@ -260,8 +260,7 @@ function normalizeConfig(config) {
|
|
|
260
260
|
let transformers = {};
|
|
261
261
|
if (typeof transform === "function") {
|
|
262
262
|
transformers.DEFAULT = transform;
|
|
263
|
-
}
|
|
264
|
-
if (typeof transform === "object" && transform !== null) {
|
|
263
|
+
} else if (typeof transform === "object" && transform !== null) {
|
|
265
264
|
Object.assign(transformers, transform);
|
|
266
265
|
}
|
|
267
266
|
return transformers;
|
|
@@ -40,7 +40,7 @@ const TIMING_FNS = [
|
|
|
40
40
|
"cubic-bezier",
|
|
41
41
|
"steps"
|
|
42
42
|
];
|
|
43
|
-
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `
|
|
43
|
+
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubic-bezier(a, b, c)` these don't count.
|
|
44
44
|
;
|
|
45
45
|
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
46
46
|
;
|
package/lib/util/parseGlob.js
CHANGED
|
@@ -27,7 +27,9 @@ const defaultConfigFiles = [
|
|
|
27
27
|
"./tailwind.config.js",
|
|
28
28
|
"./tailwind.config.cjs",
|
|
29
29
|
"./tailwind.config.mjs",
|
|
30
|
-
"./tailwind.config.ts"
|
|
30
|
+
"./tailwind.config.ts",
|
|
31
|
+
"./tailwind.config.cts",
|
|
32
|
+
"./tailwind.config.mts"
|
|
31
33
|
];
|
|
32
34
|
function isObject(value) {
|
|
33
35
|
return typeof value === "object" && value !== null;
|
|
@@ -35,11 +35,7 @@ function splitAtTopLevelOnly(input, separator) {
|
|
|
35
35
|
lastPos = idx + separator.length;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
isEscaped = false;
|
|
40
|
-
} else if (char === "\\") {
|
|
41
|
-
isEscaped = true;
|
|
42
|
-
}
|
|
38
|
+
isEscaped = isEscaped ? false : char === "\\";
|
|
43
39
|
if (char === "(" || char === "[" || char === "{") {
|
|
44
40
|
stack.push(char);
|
|
45
41
|
} else if (char === ")" && stack[stack.length - 1] === "(" || char === "]" && stack[stack.length - 1] === "[" || char === "}" && stack[stack.length - 1] === "{") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "0.0.0-insiders.
|
|
3
|
+
"version": "0.0.0-insiders.ed3c535",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"autoprefixer": "^10.4.14",
|
|
51
51
|
"browserslist": "^4.21.5",
|
|
52
52
|
"concurrently": "^8.0.1",
|
|
53
|
-
"cssnano": "^6.
|
|
53
|
+
"cssnano": "^6.1.2",
|
|
54
54
|
"esbuild": "^0.20.2",
|
|
55
55
|
"eslint": "^8.39.0",
|
|
56
56
|
"eslint-config-prettier": "^8.8.0",
|