tailwindcss 0.0.0-insiders.ac8fbc6 → 0.0.0-insiders.ac91c6a
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 +10 -7
- package/lib/cli.js +21 -44
- package/lib/corePlugins.js +55 -46
- package/lib/featureFlags.js +3 -5
- package/lib/index.js +1 -2
- package/lib/lib/cacheInvalidation.js +32 -14
- package/lib/lib/collapseAdjacentRules.js +1 -2
- package/lib/lib/defaultExtractor.js +34 -18
- package/lib/lib/evaluateTailwindFunctions.js +7 -10
- package/lib/lib/expandApplyAtRules.js +11 -26
- package/lib/lib/expandTailwindAtRules.js +36 -22
- package/lib/lib/generateRules.js +63 -37
- package/lib/lib/regex.js +1 -2
- package/lib/lib/resolveDefaultsAtRules.js +6 -9
- package/lib/lib/setupContextUtils.js +56 -47
- package/lib/lib/setupTrackingContext.js +4 -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 +5 -10
- package/lib/util/createPlugin.js +1 -2
- package/lib/util/createUtilityPlugin.js +1 -2
- package/lib/util/dataTypes.js +5 -10
- package/lib/util/flattenColorPalette.js +2 -5
- package/lib/util/formatVariantSelector.js +1 -2
- package/lib/util/getAllConfigs.js +2 -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 -16
- package/lib/util/normalizeScreens.js +1 -2
- package/lib/util/parseAnimationValue.js +1 -2
- package/lib/util/pluginUtils.js +11 -3
- package/lib/util/resolveConfig.js +10 -37
- package/lib/util/splitAtTopLevelOnly.js +32 -14
- package/lib/util/withAlphaVariable.js +5 -5
- package/package.json +7 -6
- package/peers/index.js +9 -7
- package/src/cli.js +5 -14
- package/src/corePlugins.js +9 -2
- package/src/featureFlags.js +1 -1
- package/src/lib/evaluateTailwindFunctions.js +2 -0
- package/src/lib/generateRules.js +21 -1
- package/src/lib/resolveDefaultsAtRules.js +1 -1
- package/src/lib/setupContextUtils.js +10 -2
- package/src/util/log.js +1 -1
- package/src/util/pluginUtils.js +13 -1
- package/src/util/resolveConfig.js +5 -33
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +1 -0
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/index.d.ts +1 -1
- package/types.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -25,16 +25,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
25
25
|
- Create tailwind.config.cjs file in ESM package when running init ([#8363](https://github.com/tailwindlabs/tailwindcss/pull/8363))
|
|
26
26
|
- Fix `matchVariants` that use at-rules and placeholders ([#8392](https://github.com/tailwindlabs/tailwindcss/pull/8392))
|
|
27
27
|
- Improve types of the `tailwindcss/plugin` ([#8400](https://github.com/tailwindlabs/tailwindcss/pull/8400))
|
|
28
|
+
- Allow returning parallel variants from `addVariant` or `matchVariant` callback functions ([#8455](https://github.com/tailwindlabs/tailwindcss/pull/8455))
|
|
29
|
+
- Try using local `postcss` installation first in the CLI ([#8270](https://github.com/tailwindlabs/tailwindcss/pull/8270))
|
|
30
|
+
- Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
|
|
31
|
+
- Don't inherit `to` value from parent gradients ([#8489](https://github.com/tailwindlabs/tailwindcss/pull/8489))
|
|
32
|
+
- Remove process dependency from log functions ([#8530](https://github.com/tailwindlabs/tailwindcss/pull/8530))
|
|
28
33
|
|
|
29
34
|
### Changed
|
|
30
35
|
|
|
31
|
-
- Try using local `postcss` installation first in the CLI ([#8270](https://github.com/tailwindlabs/tailwindcss/pull/8270))
|
|
32
36
|
- Only apply hover styles when supported (future) ([#8394](https://github.com/tailwindlabs/tailwindcss/pull/8394))
|
|
37
|
+
- Respect default ring color opacity (future) ([#8448](https://github.com/tailwindlabs/tailwindcss/pull/8448), [3f4005e](https://github.com/tailwindlabs/tailwindcss/commit/3f4005e833445f7549219eb5ae89728cbb3a2630))
|
|
33
38
|
|
|
34
39
|
### Added
|
|
35
40
|
|
|
36
|
-
- Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
|
|
37
|
-
- Add `rgb` and `hsl` color helpers for CSS variables ([#7665](https://github.com/tailwindlabs/tailwindcss/pull/7665))
|
|
38
41
|
- Support PostCSS `Document` nodes ([#7291](https://github.com/tailwindlabs/tailwindcss/pull/7291))
|
|
39
42
|
- Add `text-start` and `text-end` utilities ([#6656](https://github.com/tailwindlabs/tailwindcss/pull/6656))
|
|
40
43
|
- Support customizing class name when using `darkMode: 'class'` ([#5800](https://github.com/tailwindlabs/tailwindcss/pull/5800))
|
|
@@ -42,16 +45,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
42
45
|
- Add new `border-spacing` utilities ([#7102](https://github.com/tailwindlabs/tailwindcss/pull/7102))
|
|
43
46
|
- Add `enabled` variant ([#7905](https://github.com/tailwindlabs/tailwindcss/pull/7905))
|
|
44
47
|
- Add TypeScript types for the `tailwind.config.js` file ([#7891](https://github.com/tailwindlabs/tailwindcss/pull/7891))
|
|
45
|
-
- Add `backdrop` variant ([#7924](https://github.com/tailwindlabs/tailwindcss/pull/7924))
|
|
48
|
+
- Add `backdrop` variant ([#7924](https://github.com/tailwindlabs/tailwindcss/pull/7924), [#8526](https://github.com/tailwindlabs/tailwindcss/pull/8526))
|
|
46
49
|
- Add `grid-flow-dense` utility ([#8193](https://github.com/tailwindlabs/tailwindcss/pull/8193))
|
|
47
50
|
- Add `mix-blend-plus-lighter` utility ([#8288](https://github.com/tailwindlabs/tailwindcss/pull/8288))
|
|
48
51
|
- Add arbitrary variants ([#8299](https://github.com/tailwindlabs/tailwindcss/pull/8299))
|
|
49
|
-
- Add `matchVariant` API ([#8310](https://github.com/tailwindlabs/tailwindcss/pull/8310))
|
|
52
|
+
- Add experimental `matchVariant` API ([#8310](https://github.com/tailwindlabs/tailwindcss/pull/8310), [34fd0fb8](https://github.com/tailwindlabs/tailwindcss/commit/34fd0fb82aa574cddc5c7aa3ad7d1af5e3735e5d))
|
|
50
53
|
- Add `prefers-contrast` media query variants ([#8410](https://github.com/tailwindlabs/tailwindcss/pull/8410))
|
|
51
|
-
- Experimental support for variant grouping ([#8405](https://github.com/tailwindlabs/tailwindcss/pull/8405))
|
|
52
54
|
- Add opacity support when referencing colors with `theme` function ([#8416](https://github.com/tailwindlabs/tailwindcss/pull/8416))
|
|
53
55
|
- Add `postcss-import` support to the CLI ([#8437](https://github.com/tailwindlabs/tailwindcss/pull/8437))
|
|
54
|
-
- Add
|
|
56
|
+
- Add `optional` variant ([#8486](https://github.com/tailwindlabs/tailwindcss/pull/8486))
|
|
57
|
+
- Add `<alpha-value>` placeholder support for custom colors ([#8501](https://github.com/tailwindlabs/tailwindcss/pull/8501))
|
|
55
58
|
|
|
56
59
|
## [3.0.24] - 2022-04-12
|
|
57
60
|
|
package/lib/cli.js
CHANGED
|
@@ -72,10 +72,8 @@ function drainStdin() {
|
|
|
72
72
|
process.stdin.on("data", (chunk)=>{
|
|
73
73
|
result += chunk;
|
|
74
74
|
});
|
|
75
|
-
process.stdin.on("end", ()=>resolve(result)
|
|
76
|
-
);
|
|
77
|
-
process.stdin.on("error", (err)=>reject(err)
|
|
78
|
-
);
|
|
75
|
+
process.stdin.on("end", ()=>resolve(result));
|
|
76
|
+
process.stdin.on("error", (err)=>reject(err));
|
|
79
77
|
});
|
|
80
78
|
}
|
|
81
79
|
function help({ message , usage , commands: commands1 , options }) {
|
|
@@ -166,10 +164,6 @@ let commands = {
|
|
|
166
164
|
type: Boolean,
|
|
167
165
|
description: `Initialize a \`${configs.postcss}\` file`
|
|
168
166
|
},
|
|
169
|
-
"--types": {
|
|
170
|
-
type: Boolean,
|
|
171
|
-
description: `Add TypeScript types for the \`${configs.tailwind}\` file`
|
|
172
|
-
},
|
|
173
167
|
"-f": "--full",
|
|
174
168
|
"-p": "--postcss"
|
|
175
169
|
}
|
|
@@ -233,16 +227,13 @@ let sharedFlags = {
|
|
|
233
227
|
},
|
|
234
228
|
"-h": "--help"
|
|
235
229
|
};
|
|
236
|
-
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined
|
|
237
|
-
))) {
|
|
230
|
+
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
|
|
238
231
|
help({
|
|
239
232
|
usage: [
|
|
240
233
|
"tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
|
|
241
|
-
"tailwindcss init [--full] [--postcss] [
|
|
234
|
+
"tailwindcss init [--full] [--postcss] [options...]",
|
|
242
235
|
],
|
|
243
|
-
commands: Object.keys(commands).filter((command2)=>command2 !== "build"
|
|
244
|
-
).map((command3)=>`${command3} [options]`
|
|
245
|
-
),
|
|
236
|
+
commands: Object.keys(commands).filter((command2)=>command2 !== "build").map((command3)=>`${command3} [options]`),
|
|
246
237
|
options: {
|
|
247
238
|
...commands.build.args,
|
|
248
239
|
...sharedFlags
|
|
@@ -250,8 +241,7 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
|
|
|
250
241
|
});
|
|
251
242
|
process.exit(0);
|
|
252
243
|
}
|
|
253
|
-
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg
|
|
254
|
-
)(process.argv[2]) || "build";
|
|
244
|
+
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
|
|
255
245
|
if (commands[command] === undefined) {
|
|
256
246
|
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
257
247
|
// TODO: Deprecate this in future versions
|
|
@@ -263,9 +253,7 @@ if (commands[command] === undefined) {
|
|
|
263
253
|
usage: [
|
|
264
254
|
"tailwindcss <command> [options]"
|
|
265
255
|
],
|
|
266
|
-
commands: Object.keys(commands).filter((command4)=>command4 !== "build"
|
|
267
|
-
).map((command5)=>`${command5} [options]`
|
|
268
|
-
),
|
|
256
|
+
commands: Object.keys(commands).filter((command4)=>command4 !== "build").map((command5)=>`${command5} [options]`),
|
|
269
257
|
options: sharedFlags
|
|
270
258
|
});
|
|
271
259
|
process.exit(1);
|
|
@@ -284,8 +272,7 @@ let args = (()=>{
|
|
|
284
272
|
}).map(([key, value])=>[
|
|
285
273
|
key,
|
|
286
274
|
typeof value === "object" ? value.type : value
|
|
287
|
-
]
|
|
288
|
-
)), {
|
|
275
|
+
])), {
|
|
289
276
|
permissive: true
|
|
290
277
|
});
|
|
291
278
|
// Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
|
|
@@ -357,10 +344,6 @@ function init() {
|
|
|
357
344
|
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
|
358
345
|
} else {
|
|
359
346
|
let stubFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../stubs/defaultConfig.stub.js") : _path.default.resolve(__dirname, "../stubs/simpleConfig.stub.js"), "utf8");
|
|
360
|
-
if (args["--types"]) {
|
|
361
|
-
let typesHeading = "/** @type {import('tailwindcss/types').Config} */";
|
|
362
|
-
stubFile = stubFile.replace(`module.exports = `, `${typesHeading}\nconst config = `) + "\nmodule.exports = config";
|
|
363
|
-
}
|
|
364
347
|
// Change colors import
|
|
365
348
|
stubFile = stubFile.replace("../colors", "tailwindcss/colors");
|
|
366
349
|
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
|
|
@@ -406,8 +389,7 @@ async function build() {
|
|
|
406
389
|
console.error(`Specified config file ${args["--config"]} does not exist.`);
|
|
407
390
|
process.exit(9);
|
|
408
391
|
}
|
|
409
|
-
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null
|
|
410
|
-
)(_path.default.resolve(`./${configs.tailwind}`));
|
|
392
|
+
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve(`./${configs.tailwind}`));
|
|
411
393
|
async function loadPostCssPlugins() {
|
|
412
394
|
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
|
413
395
|
let config1 = customPostCssPath ? await (async ()=>{
|
|
@@ -478,8 +460,7 @@ async function build() {
|
|
|
478
460
|
// like an object it's probably a raw content object. But this object
|
|
479
461
|
// is not watchable, so let's remove it.
|
|
480
462
|
return typeof file === "string";
|
|
481
|
-
}).map((glob)=>(0, _normalizePath).default(glob)
|
|
482
|
-
);
|
|
463
|
+
}).map((glob)=>(0, _normalizePath).default(glob));
|
|
483
464
|
}
|
|
484
465
|
function extractRawContent(config) {
|
|
485
466
|
return config.content.files.filter((file)=>{
|
|
@@ -568,13 +549,11 @@ async function build() {
|
|
|
568
549
|
let start = process.hrtime.bigint();
|
|
569
550
|
return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
570
551
|
recursive: true
|
|
571
|
-
}) : null
|
|
572
|
-
).then(()=>processor.process(css, {
|
|
552
|
+
}) : null).then(()=>processor.process(css, {
|
|
573
553
|
...postcssOptions,
|
|
574
554
|
from: input,
|
|
575
555
|
to: output
|
|
576
|
-
})
|
|
577
|
-
).then((result)=>{
|
|
556
|
+
})).then((result)=>{
|
|
578
557
|
if (!output) {
|
|
579
558
|
return process.stdout.write(result.css);
|
|
580
559
|
}
|
|
@@ -585,7 +564,7 @@ async function build() {
|
|
|
585
564
|
}).then(()=>{
|
|
586
565
|
let end = process.hrtime.bigint();
|
|
587
566
|
console.error();
|
|
588
|
-
console.error("Done in", (end - start) / BigInt(
|
|
567
|
+
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
|
589
568
|
});
|
|
590
569
|
}
|
|
591
570
|
let css1 = await (()=>{
|
|
@@ -614,8 +593,7 @@ async function build() {
|
|
|
614
593
|
delete require.cache[require.resolve(file1)];
|
|
615
594
|
}
|
|
616
595
|
if (configPath) {
|
|
617
|
-
configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file
|
|
618
|
-
);
|
|
596
|
+
configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file);
|
|
619
597
|
for (let dependency of configDependencies){
|
|
620
598
|
contextDependencies.add(dependency);
|
|
621
599
|
}
|
|
@@ -690,12 +668,10 @@ async function build() {
|
|
|
690
668
|
let start = process.hrtime.bigint();
|
|
691
669
|
return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
692
670
|
recursive: true
|
|
693
|
-
}) : null
|
|
694
|
-
).then(()=>processor.process(css, {
|
|
671
|
+
}) : null).then(()=>processor.process(css, {
|
|
695
672
|
from: input,
|
|
696
673
|
to: output
|
|
697
|
-
})
|
|
698
|
-
).then(async (result)=>{
|
|
674
|
+
})).then(async (result)=>{
|
|
699
675
|
for (let message of result.messages){
|
|
700
676
|
if (message.type === "dependency") {
|
|
701
677
|
contextDependencies.add(message.file);
|
|
@@ -713,7 +689,7 @@ async function build() {
|
|
|
713
689
|
].filter(Boolean));
|
|
714
690
|
}).then(()=>{
|
|
715
691
|
let end = process.hrtime.bigint();
|
|
716
|
-
console.error("Done in", (end - start) / BigInt(
|
|
692
|
+
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
|
717
693
|
}).catch((err)=>{
|
|
718
694
|
if (err.name === "CssSyntaxError") {
|
|
719
695
|
console.error(err.toString());
|
|
@@ -795,9 +771,10 @@ async function build() {
|
|
|
795
771
|
});
|
|
796
772
|
}
|
|
797
773
|
if (shouldWatch) {
|
|
798
|
-
/* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.
|
|
799
|
-
|
|
800
|
-
|
|
774
|
+
/* Abort the watcher if stdin is closed to avoid zombie processes */ if (process.stdin.isTTY) {
|
|
775
|
+
process.stdin.on("end", ()=>process.exit(0));
|
|
776
|
+
process.stdin.resume();
|
|
777
|
+
}
|
|
801
778
|
startWatcher();
|
|
802
779
|
} else {
|
|
803
780
|
buildOnce();
|
package/lib/corePlugins.js
CHANGED
|
@@ -25,26 +25,44 @@ function _interopRequireDefault(obj) {
|
|
|
25
25
|
default: obj
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
+
function _getRequireWildcardCache() {
|
|
29
|
+
if (typeof WeakMap !== "function") return null;
|
|
30
|
+
var cache = new WeakMap();
|
|
31
|
+
_getRequireWildcardCache = function() {
|
|
32
|
+
return cache;
|
|
33
|
+
};
|
|
34
|
+
return cache;
|
|
35
|
+
}
|
|
28
36
|
function _interopRequireWildcard(obj) {
|
|
29
37
|
if (obj && obj.__esModule) {
|
|
30
38
|
return obj;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
}
|
|
40
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
41
|
+
return {
|
|
42
|
+
default: obj
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var cache = _getRequireWildcardCache();
|
|
46
|
+
if (cache && cache.has(obj)) {
|
|
47
|
+
return cache.get(obj);
|
|
48
|
+
}
|
|
49
|
+
var newObj = {};
|
|
50
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
51
|
+
for(var key in obj){
|
|
52
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
53
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
54
|
+
if (desc && (desc.get || desc.set)) {
|
|
55
|
+
Object.defineProperty(newObj, key, desc);
|
|
56
|
+
} else {
|
|
57
|
+
newObj[key] = obj[key];
|
|
43
58
|
}
|
|
44
59
|
}
|
|
45
|
-
newObj.default = obj;
|
|
46
|
-
return newObj;
|
|
47
60
|
}
|
|
61
|
+
newObj.default = obj;
|
|
62
|
+
if (cache) {
|
|
63
|
+
cache.set(obj, newObj);
|
|
64
|
+
}
|
|
65
|
+
return newObj;
|
|
48
66
|
}
|
|
49
67
|
let variantPlugins = {
|
|
50
68
|
pseudoElementVariants: ({ addVariant })=>{
|
|
@@ -152,6 +170,7 @@ let variantPlugins = {
|
|
|
152
170
|
"indeterminate",
|
|
153
171
|
"placeholder-shown",
|
|
154
172
|
"autofill",
|
|
173
|
+
"optional",
|
|
155
174
|
"required",
|
|
156
175
|
"valid",
|
|
157
176
|
"invalid",
|
|
@@ -174,8 +193,7 @@ let variantPlugins = {
|
|
|
174
193
|
].map((variant)=>Array.isArray(variant) ? variant : [
|
|
175
194
|
variant,
|
|
176
195
|
`&:${variant}`
|
|
177
|
-
]
|
|
178
|
-
);
|
|
196
|
+
]);
|
|
179
197
|
for (let [variantName, state] of pseudoVariants){
|
|
180
198
|
addVariant(variantName, (ctx)=>{
|
|
181
199
|
let result = typeof state === "function" ? state(ctx) : state;
|
|
@@ -292,10 +310,7 @@ let corePlugins = {
|
|
|
292
310
|
},
|
|
293
311
|
container: (()=>{
|
|
294
312
|
function extractMinWidths(breakpoints = []) {
|
|
295
|
-
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min
|
|
296
|
-
)
|
|
297
|
-
).filter((v)=>v !== undefined
|
|
298
|
-
);
|
|
313
|
+
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min)).filter((v)=>v !== undefined);
|
|
299
314
|
}
|
|
300
315
|
function mapMinWidthsToPadding(minWidths, screens, paddings) {
|
|
301
316
|
if (typeof paddings === "undefined") {
|
|
@@ -337,8 +352,7 @@ let corePlugins = {
|
|
|
337
352
|
let minWidths = extractMinWidths(screens);
|
|
338
353
|
let paddings = mapMinWidthsToPadding(minWidths, screens, theme("container.padding"));
|
|
339
354
|
let generatePaddingFor = (minWidth)=>{
|
|
340
|
-
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth
|
|
341
|
-
);
|
|
355
|
+
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth);
|
|
342
356
|
if (!paddingConfig) {
|
|
343
357
|
return {};
|
|
344
358
|
}
|
|
@@ -347,16 +361,14 @@ let corePlugins = {
|
|
|
347
361
|
paddingLeft: paddingConfig.padding
|
|
348
362
|
};
|
|
349
363
|
};
|
|
350
|
-
let atRules = Array.from(new Set(minWidths.slice().sort((a, z)=>parseInt(a) - parseInt(z)
|
|
351
|
-
))).map((minWidth)=>({
|
|
364
|
+
let atRules = Array.from(new Set(minWidths.slice().sort((a, z)=>parseInt(a) - parseInt(z)))).map((minWidth)=>({
|
|
352
365
|
[`@media (min-width: ${minWidth})`]: {
|
|
353
366
|
".container": {
|
|
354
367
|
"max-width": minWidth,
|
|
355
368
|
...generatePaddingFor(minWidth)
|
|
356
369
|
}
|
|
357
370
|
}
|
|
358
|
-
})
|
|
359
|
-
);
|
|
371
|
+
}));
|
|
360
372
|
addComponents([
|
|
361
373
|
{
|
|
362
374
|
".container": Object.assign({
|
|
@@ -1033,8 +1045,7 @@ let corePlugins = {
|
|
|
1033
1045
|
});
|
|
1034
1046
|
},
|
|
1035
1047
|
animation: ({ matchUtilities , theme , config })=>{
|
|
1036
|
-
let prefixName = (name)=>`${config("prefix")}${(0, _escapeClassName).default(name)}
|
|
1037
|
-
;
|
|
1048
|
+
let prefixName = (name)=>`${config("prefix")}${(0, _escapeClassName).default(name)}`;
|
|
1038
1049
|
var ref;
|
|
1039
1050
|
let keyframes = Object.fromEntries(Object.entries((ref = theme("keyframes")) !== null && ref !== void 0 ? ref : {}).map(([key, value])=>{
|
|
1040
1051
|
return [
|
|
@@ -1048,8 +1059,7 @@ let corePlugins = {
|
|
|
1048
1059
|
animate: (value1)=>{
|
|
1049
1060
|
let animations = (0, _parseAnimationValue).default(value1);
|
|
1050
1061
|
return [
|
|
1051
|
-
...animations.flatMap((animation)=>keyframes[animation.name]
|
|
1052
|
-
),
|
|
1062
|
+
...animations.flatMap((animation)=>keyframes[animation.name]),
|
|
1053
1063
|
{
|
|
1054
1064
|
animation: animations.map(({ name , value })=>{
|
|
1055
1065
|
if (name === undefined || keyframes[name] === undefined) {
|
|
@@ -1749,8 +1759,7 @@ let corePlugins = {
|
|
|
1749
1759
|
};
|
|
1750
1760
|
}
|
|
1751
1761
|
}, {
|
|
1752
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
1753
|
-
)((0, _flattenColorPalette).default(theme("divideColor"))),
|
|
1762
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("divideColor"))),
|
|
1754
1763
|
type: "color"
|
|
1755
1764
|
});
|
|
1756
1765
|
},
|
|
@@ -2152,8 +2161,7 @@ let corePlugins = {
|
|
|
2152
2161
|
});
|
|
2153
2162
|
}
|
|
2154
2163
|
}, {
|
|
2155
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2156
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2164
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2157
2165
|
type: [
|
|
2158
2166
|
"color"
|
|
2159
2167
|
]
|
|
@@ -2192,8 +2200,7 @@ let corePlugins = {
|
|
|
2192
2200
|
});
|
|
2193
2201
|
}
|
|
2194
2202
|
}, {
|
|
2195
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2196
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2203
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2197
2204
|
type: "color"
|
|
2198
2205
|
});
|
|
2199
2206
|
matchUtilities({
|
|
@@ -2246,8 +2253,7 @@ let corePlugins = {
|
|
|
2246
2253
|
});
|
|
2247
2254
|
}
|
|
2248
2255
|
}, {
|
|
2249
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2250
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2256
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2251
2257
|
type: "color"
|
|
2252
2258
|
});
|
|
2253
2259
|
},
|
|
@@ -2317,7 +2323,8 @@ let corePlugins = {
|
|
|
2317
2323
|
let transparentToValue = transparentTo(value);
|
|
2318
2324
|
return {
|
|
2319
2325
|
"--tw-gradient-from": (0, _toColorValue).default(value, "from"),
|
|
2320
|
-
"--tw-gradient-
|
|
2326
|
+
"--tw-gradient-to": transparentToValue,
|
|
2327
|
+
"--tw-gradient-stops": `var(--tw-gradient-from), var(--tw-gradient-to)`
|
|
2321
2328
|
};
|
|
2322
2329
|
}
|
|
2323
2330
|
}, options);
|
|
@@ -2325,7 +2332,8 @@ let corePlugins = {
|
|
|
2325
2332
|
via: (value)=>{
|
|
2326
2333
|
let transparentToValue = transparentTo(value);
|
|
2327
2334
|
return {
|
|
2328
|
-
"--tw-gradient-
|
|
2335
|
+
"--tw-gradient-to": transparentToValue,
|
|
2336
|
+
"--tw-gradient-stops": `var(--tw-gradient-from), ${(0, _toColorValue).default(value, "via")}, var(--tw-gradient-to)`
|
|
2329
2337
|
};
|
|
2330
2338
|
}
|
|
2331
2339
|
}, options);
|
|
@@ -3204,12 +3212,15 @@ let corePlugins = {
|
|
|
3204
3212
|
},
|
|
3205
3213
|
ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme , config })=>{
|
|
3206
3214
|
let ringColorDefault = (()=>{
|
|
3207
|
-
var ref;
|
|
3215
|
+
var ref, ref1;
|
|
3208
3216
|
if ((0, _featureFlags).flagEnabled(config(), "respectDefaultRingColorOpacity")) {
|
|
3209
3217
|
return theme("ringColor.DEFAULT");
|
|
3210
3218
|
}
|
|
3211
3219
|
let ringOpacityDefault = theme("ringOpacity.DEFAULT", "0.5");
|
|
3212
|
-
|
|
3220
|
+
if (!((ref = theme("ringColor")) === null || ref === void 0 ? void 0 : ref.DEFAULT)) {
|
|
3221
|
+
return `rgb(147 197 253 / ${ringOpacityDefault})`;
|
|
3222
|
+
}
|
|
3223
|
+
return (0, _withAlphaVariable).withAlphaValue((ref1 = theme("ringColor")) === null || ref1 === void 0 ? void 0 : ref1.DEFAULT, ringOpacityDefault, `rgb(147 197 253 / ${ringOpacityDefault})`);
|
|
3213
3224
|
})();
|
|
3214
3225
|
addDefaults("ring-width", {
|
|
3215
3226
|
"--tw-ring-inset": " ",
|
|
@@ -3260,8 +3271,7 @@ let corePlugins = {
|
|
|
3260
3271
|
});
|
|
3261
3272
|
}
|
|
3262
3273
|
}, {
|
|
3263
|
-
values: Object.fromEntries(Object.entries((0, _flattenColorPalette).default(theme("ringColor"))).filter(([modifier])=>modifier !== "DEFAULT"
|
|
3264
|
-
)),
|
|
3274
|
+
values: Object.fromEntries(Object.entries((0, _flattenColorPalette).default(theme("ringColor"))).filter(([modifier])=>modifier !== "DEFAULT")),
|
|
3265
3275
|
type: "color"
|
|
3266
3276
|
});
|
|
3267
3277
|
},
|
|
@@ -3343,8 +3353,7 @@ let corePlugins = {
|
|
|
3343
3353
|
matchUtilities({
|
|
3344
3354
|
"drop-shadow": (value)=>{
|
|
3345
3355
|
return {
|
|
3346
|
-
"--tw-drop-shadow": Array.isArray(value) ? value.map((v)=>`drop-shadow(${v})`
|
|
3347
|
-
).join(" ") : `drop-shadow(${value})`,
|
|
3356
|
+
"--tw-drop-shadow": Array.isArray(value) ? value.map((v)=>`drop-shadow(${v})`).join(" ") : `drop-shadow(${value})`,
|
|
3348
3357
|
"@defaults filter": {},
|
|
3349
3358
|
filter: cssFilterValue
|
|
3350
3359
|
};
|
package/lib/featureFlags.js
CHANGED
|
@@ -22,7 +22,7 @@ let featureFlags = {
|
|
|
22
22
|
],
|
|
23
23
|
experimental: [
|
|
24
24
|
"optimizeUniversalDefaults",
|
|
25
|
-
"variantGrouping
|
|
25
|
+
"matchVariant" /* , 'variantGrouping' */
|
|
26
26
|
]
|
|
27
27
|
};
|
|
28
28
|
function flagEnabled(config, flag) {
|
|
@@ -43,16 +43,14 @@ function experimentalFlagsEnabled(config) {
|
|
|
43
43
|
return featureFlags.experimental;
|
|
44
44
|
}
|
|
45
45
|
var ref;
|
|
46
|
-
return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]
|
|
47
|
-
);
|
|
46
|
+
return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
|
|
48
47
|
}
|
|
49
48
|
function issueFlagNotices(config) {
|
|
50
49
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
52
|
if (experimentalFlagsEnabled(config).length > 0) {
|
|
54
|
-
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)
|
|
55
|
-
).join(", ");
|
|
53
|
+
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
|
|
56
54
|
_log.default.warn("experimental-flags-enabled", [
|
|
57
55
|
`You have enabled experimental features: ${changes}`,
|
|
58
56
|
"Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time.",
|
package/lib/index.js
CHANGED
|
@@ -19,8 +19,7 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
19
19
|
function(root, result) {
|
|
20
20
|
let context = (0, _setupTrackingContext).default(configOrPath);
|
|
21
21
|
if (root.type === "document") {
|
|
22
|
-
let roots = root.nodes.filter((node)=>node.type === "root"
|
|
23
|
-
);
|
|
22
|
+
let roots = root.nodes.filter((node)=>node.type === "root");
|
|
24
23
|
for (const root1 of roots){
|
|
25
24
|
if (root1.type === "root") {
|
|
26
25
|
(0, _processTailwindFeatures).default(context)(root1, result);
|
|
@@ -10,26 +10,44 @@ function _interopRequireDefault(obj) {
|
|
|
10
10
|
default: obj
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
+
function _getRequireWildcardCache() {
|
|
14
|
+
if (typeof WeakMap !== "function") return null;
|
|
15
|
+
var cache = new WeakMap();
|
|
16
|
+
_getRequireWildcardCache = function() {
|
|
17
|
+
return cache;
|
|
18
|
+
};
|
|
19
|
+
return cache;
|
|
20
|
+
}
|
|
13
21
|
function _interopRequireWildcard(obj) {
|
|
14
22
|
if (obj && obj.__esModule) {
|
|
15
23
|
return obj;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
}
|
|
25
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
26
|
+
return {
|
|
27
|
+
default: obj
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var cache = _getRequireWildcardCache();
|
|
31
|
+
if (cache && cache.has(obj)) {
|
|
32
|
+
return cache.get(obj);
|
|
33
|
+
}
|
|
34
|
+
var newObj = {};
|
|
35
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
36
|
+
for(var key in obj){
|
|
37
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
38
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
39
|
+
if (desc && (desc.get || desc.set)) {
|
|
40
|
+
Object.defineProperty(newObj, key, desc);
|
|
41
|
+
} else {
|
|
42
|
+
newObj[key] = obj[key];
|
|
28
43
|
}
|
|
29
44
|
}
|
|
30
|
-
newObj.default = obj;
|
|
31
|
-
return newObj;
|
|
32
45
|
}
|
|
46
|
+
newObj.default = obj;
|
|
47
|
+
if (cache) {
|
|
48
|
+
cache.set(obj, newObj);
|
|
49
|
+
}
|
|
50
|
+
return newObj;
|
|
33
51
|
}
|
|
34
52
|
/**
|
|
35
53
|
* Calculate the hash of a string.
|
|
@@ -19,8 +19,7 @@ function collapseAdjacentRules() {
|
|
|
19
19
|
var _property, _property1;
|
|
20
20
|
if (node.type === "atrule" && node.name === "font-face") {
|
|
21
21
|
currentRule = node;
|
|
22
|
-
} else if (properties.every((property)=>((_property = node[property]) !== null && _property !== void 0 ? _property : "").replace(/\s+/g, " ") === ((_property1 = currentRule[property]) !== null && _property1 !== void 0 ? _property1 : "").replace(/\s+/g, " ")
|
|
23
|
-
)) {
|
|
22
|
+
} else if (properties.every((property)=>((_property = node[property]) !== null && _property !== void 0 ? _property : "").replace(/\s+/g, " ") === ((_property1 = currentRule[property]) !== null && _property1 !== void 0 ? _property1 : "").replace(/\s+/g, " "))) {
|
|
24
23
|
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
|
25
24
|
if (node.nodes) {
|
|
26
25
|
currentRule.append(node.nodes);
|
|
@@ -5,26 +5,44 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.defaultExtractor = defaultExtractor;
|
|
6
6
|
var _featureFlagsJs = require("../featureFlags.js");
|
|
7
7
|
var regex = _interopRequireWildcard(require("./regex"));
|
|
8
|
+
function _getRequireWildcardCache() {
|
|
9
|
+
if (typeof WeakMap !== "function") return null;
|
|
10
|
+
var cache = new WeakMap();
|
|
11
|
+
_getRequireWildcardCache = function() {
|
|
12
|
+
return cache;
|
|
13
|
+
};
|
|
14
|
+
return cache;
|
|
15
|
+
}
|
|
8
16
|
function _interopRequireWildcard(obj) {
|
|
9
17
|
if (obj && obj.__esModule) {
|
|
10
18
|
return obj;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
}
|
|
20
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
21
|
+
return {
|
|
22
|
+
default: obj
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
var cache = _getRequireWildcardCache();
|
|
26
|
+
if (cache && cache.has(obj)) {
|
|
27
|
+
return cache.get(obj);
|
|
28
|
+
}
|
|
29
|
+
var newObj = {};
|
|
30
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
31
|
+
for(var key in obj){
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
33
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
34
|
+
if (desc && (desc.get || desc.set)) {
|
|
35
|
+
Object.defineProperty(newObj, key, desc);
|
|
36
|
+
} else {
|
|
37
|
+
newObj[key] = obj[key];
|
|
23
38
|
}
|
|
24
39
|
}
|
|
25
|
-
newObj.default = obj;
|
|
26
|
-
return newObj;
|
|
27
40
|
}
|
|
41
|
+
newObj.default = obj;
|
|
42
|
+
if (cache) {
|
|
43
|
+
cache.set(obj, newObj);
|
|
44
|
+
}
|
|
45
|
+
return newObj;
|
|
28
46
|
}
|
|
29
47
|
function defaultExtractor(context) {
|
|
30
48
|
let patterns = Array.from(buildRegExps(context));
|
|
@@ -36,8 +54,7 @@ function defaultExtractor(context) {
|
|
|
36
54
|
var ref;
|
|
37
55
|
results.push(...(ref = content.match(pattern)) !== null && ref !== void 0 ? ref : []);
|
|
38
56
|
}
|
|
39
|
-
return results.filter((v)=>v !== undefined
|
|
40
|
-
).map(clipAtBalancedParens);
|
|
57
|
+
return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
|
|
41
58
|
};
|
|
42
59
|
}
|
|
43
60
|
function* buildRegExps(context) {
|
|
@@ -143,8 +160,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
|
|
143
160
|
return groups.map((group, idx)=>Object.assign([], match, {
|
|
144
161
|
index: match.index + idx,
|
|
145
162
|
0: group
|
|
146
|
-
})
|
|
147
|
-
);
|
|
163
|
+
}));
|
|
148
164
|
});
|
|
149
165
|
for (let match1 of matches){
|
|
150
166
|
let char = match1[0];
|