tailwindcss 0.0.0-insiders.638c8f4 → 0.0.0-insiders.64b4e6d
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 +15 -3
- package/lib/cli-peer-dependencies.js +4 -0
- package/lib/cli.js +52 -42
- package/lib/corePlugins.js +94 -69
- package/lib/featureFlags.js +8 -6
- 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 +81 -49
- package/lib/lib/evaluateTailwindFunctions.js +22 -13
- package/lib/lib/expandApplyAtRules.js +11 -26
- package/lib/lib/expandTailwindAtRules.js +36 -22
- package/lib/lib/generateRules.js +85 -40
- package/lib/lib/regex.js +1 -2
- package/lib/lib/resolveDefaultsAtRules.js +4 -8
- package/lib/lib/setupContextUtils.js +110 -73
- package/lib/lib/setupTrackingContext.js +7 -9
- package/lib/lib/sharedState.js +1 -2
- package/lib/lib/substituteScreenAtRules.js +1 -2
- package/lib/postcss-plugins/nesting/plugin.js +1 -2
- package/lib/util/buildMediaQuery.js +1 -2
- package/lib/util/cloneDeep.js +2 -4
- package/lib/util/color.js +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 +13 -16
- package/lib/util/getAllConfigs.js +10 -5
- package/lib/util/isValidArbitraryValue.js +1 -2
- package/lib/util/log.js +1 -2
- package/lib/util/negateValue.js +1 -2
- package/lib/util/normalizeConfig.js +33 -23
- package/lib/util/normalizeScreens.js +1 -2
- package/lib/util/parseAnimationValue.js +1 -2
- package/lib/util/pluginUtils.js +11 -3
- package/lib/util/resolveConfig.js +57 -56
- package/lib/util/splitAtTopLevelOnly.js +32 -14
- package/lib/util/transformThemeValue.js +4 -2
- package/lib/util/validateConfig.js +21 -0
- package/lib/util/withAlphaVariable.js +5 -5
- package/package.json +12 -10
- package/peers/index.js +3204 -1292
- package/plugin.d.ts +10 -5
- package/src/cli-peer-dependencies.js +4 -0
- package/src/cli.js +46 -9
- package/src/corePlugins.js +54 -25
- package/src/featureFlags.js +2 -2
- package/src/lib/defaultExtractor.js +56 -41
- package/src/lib/evaluateTailwindFunctions.js +20 -4
- package/src/lib/generateRules.js +46 -3
- package/src/lib/setupContextUtils.js +75 -33
- package/src/lib/setupTrackingContext.js +4 -0
- package/src/util/formatVariantSelector.js +19 -13
- package/src/util/getAllConfigs.js +7 -0
- package/src/util/normalizeConfig.js +0 -8
- package/src/util/pluginUtils.js +13 -1
- package/src/util/resolveConfig.js +66 -52
- package/src/util/toPath.js +1 -1
- package/src/util/transformThemeValue.js +4 -2
- package/src/util/validateConfig.js +13 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +1 -1
- package/types/config.d.ts +25 -23
package/CHANGELOG.md
CHANGED
|
@@ -22,15 +22,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
22
22
|
- Rewrite default class extractor ([#8204](https://github.com/tailwindlabs/tailwindcss/pull/8204))
|
|
23
23
|
- Move `important` selector to the front when `@apply`-ing selector-modifying variants in custom utilities ([#8313](https://github.com/tailwindlabs/tailwindcss/pull/8313))
|
|
24
24
|
- Error when registering an invalid custom variant ([#8345](https://github.com/tailwindlabs/tailwindcss/pull/8345))
|
|
25
|
+
- Create tailwind.config.cjs file in ESM package when running init ([#8363](https://github.com/tailwindlabs/tailwindcss/pull/8363))
|
|
26
|
+
- Fix `matchVariants` that use at-rules and placeholders ([#8392](https://github.com/tailwindlabs/tailwindcss/pull/8392))
|
|
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))
|
|
25
32
|
|
|
26
33
|
### Changed
|
|
27
34
|
|
|
28
|
-
-
|
|
35
|
+
- Only apply hover styles when supported (future) ([#8394](https://github.com/tailwindlabs/tailwindcss/pull/8394))
|
|
36
|
+
- Respect default ring color opacity (future) ([#8448](https://github.com/tailwindlabs/tailwindcss/pull/8448), [3f4005e](https://github.com/tailwindlabs/tailwindcss/commit/3f4005e833445f7549219eb5ae89728cbb3a2630))
|
|
29
37
|
|
|
30
38
|
### Added
|
|
31
39
|
|
|
32
|
-
- Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
|
|
33
|
-
- Add `rgb` and `hsl` color helpers for CSS variables ([#7665](https://github.com/tailwindlabs/tailwindcss/pull/7665))
|
|
34
40
|
- Support PostCSS `Document` nodes ([#7291](https://github.com/tailwindlabs/tailwindcss/pull/7291))
|
|
35
41
|
- Add `text-start` and `text-end` utilities ([#6656](https://github.com/tailwindlabs/tailwindcss/pull/6656))
|
|
36
42
|
- Support customizing class name when using `darkMode: 'class'` ([#5800](https://github.com/tailwindlabs/tailwindcss/pull/5800))
|
|
@@ -42,6 +48,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
42
48
|
- Add `grid-flow-dense` utility ([#8193](https://github.com/tailwindlabs/tailwindcss/pull/8193))
|
|
43
49
|
- Add `mix-blend-plus-lighter` utility ([#8288](https://github.com/tailwindlabs/tailwindcss/pull/8288))
|
|
44
50
|
- Add arbitrary variants ([#8299](https://github.com/tailwindlabs/tailwindcss/pull/8299))
|
|
51
|
+
- Add experimental `matchVariant` API ([#8310](https://github.com/tailwindlabs/tailwindcss/pull/8310), [34fd0fb8](https://github.com/tailwindlabs/tailwindcss/commit/34fd0fb82aa574cddc5c7aa3ad7d1af5e3735e5d))
|
|
52
|
+
- Add `prefers-contrast` media query variants ([#8410](https://github.com/tailwindlabs/tailwindcss/pull/8410))
|
|
53
|
+
- Add opacity support when referencing colors with `theme` function ([#8416](https://github.com/tailwindlabs/tailwindcss/pull/8416))
|
|
54
|
+
- Add `postcss-import` support to the CLI ([#8437](https://github.com/tailwindlabs/tailwindcss/pull/8437))
|
|
55
|
+
- Add `optional` variant ([#8486](https://github.com/tailwindlabs/tailwindcss/pull/8486))
|
|
56
|
+
- Add `<alpha-value>` placeholder support for custom colors ([#8501](https://github.com/tailwindlabs/tailwindcss/pull/8501))
|
|
45
57
|
|
|
46
58
|
## [3.0.24] - 2022-04-12
|
|
47
59
|
|
|
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.lazyPostcss = lazyPostcss;
|
|
6
|
+
exports.lazyPostcssImport = lazyPostcssImport;
|
|
6
7
|
exports.lazyAutoprefixer = lazyAutoprefixer;
|
|
7
8
|
exports.lazyCssnano = lazyCssnano;
|
|
8
9
|
function lazyPostcss() {
|
|
9
10
|
return require("postcss");
|
|
10
11
|
}
|
|
12
|
+
function lazyPostcssImport() {
|
|
13
|
+
return require("postcss-import");
|
|
14
|
+
}
|
|
11
15
|
function lazyAutoprefixer() {
|
|
12
16
|
return require("autoprefixer");
|
|
13
17
|
}
|
package/lib/cli.js
CHANGED
|
@@ -18,6 +18,7 @@ var _getModuleDependencies = _interopRequireDefault(require("./lib/getModuleDepe
|
|
|
18
18
|
var _log = _interopRequireDefault(require("./util/log"));
|
|
19
19
|
var _packageJson = _interopRequireDefault(require("../package.json"));
|
|
20
20
|
var _normalizePath = _interopRequireDefault(require("normalize-path"));
|
|
21
|
+
var _validateConfigJs = require("./util/validateConfig.js");
|
|
21
22
|
function _interopRequireDefault(obj) {
|
|
22
23
|
return obj && obj.__esModule ? obj : {
|
|
23
24
|
default: obj
|
|
@@ -26,6 +27,22 @@ function _interopRequireDefault(obj) {
|
|
|
26
27
|
let env = {
|
|
27
28
|
DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== "0"
|
|
28
29
|
};
|
|
30
|
+
function isESM() {
|
|
31
|
+
const pkgPath = _path.default.resolve("./package.json");
|
|
32
|
+
try {
|
|
33
|
+
let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
|
|
34
|
+
return pkg.type && pkg.type === "module";
|
|
35
|
+
} catch (err) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let configs = isESM() ? {
|
|
40
|
+
tailwind: "tailwind.config.cjs",
|
|
41
|
+
postcss: "postcss.config.cjs"
|
|
42
|
+
} : {
|
|
43
|
+
tailwind: "tailwind.config.js",
|
|
44
|
+
postcss: "postcss.config.js"
|
|
45
|
+
};
|
|
29
46
|
// ---
|
|
30
47
|
function indentRecursive(node, indent = 0) {
|
|
31
48
|
node.each && node.each((child, i)=>{
|
|
@@ -55,10 +72,8 @@ function drainStdin() {
|
|
|
55
72
|
process.stdin.on("data", (chunk)=>{
|
|
56
73
|
result += chunk;
|
|
57
74
|
});
|
|
58
|
-
process.stdin.on("end", ()=>resolve(result)
|
|
59
|
-
);
|
|
60
|
-
process.stdin.on("error", (err)=>reject(err)
|
|
61
|
-
);
|
|
75
|
+
process.stdin.on("end", ()=>resolve(result));
|
|
76
|
+
process.stdin.on("error", (err)=>reject(err));
|
|
62
77
|
});
|
|
63
78
|
}
|
|
64
79
|
function help({ message , usage , commands: commands1 , options }) {
|
|
@@ -143,15 +158,15 @@ let commands = {
|
|
|
143
158
|
args: {
|
|
144
159
|
"--full": {
|
|
145
160
|
type: Boolean,
|
|
146
|
-
description:
|
|
161
|
+
description: `Initialize a full \`${configs.tailwind}\` file`
|
|
147
162
|
},
|
|
148
163
|
"--postcss": {
|
|
149
164
|
type: Boolean,
|
|
150
|
-
description:
|
|
165
|
+
description: `Initialize a \`${configs.postcss}\` file`
|
|
151
166
|
},
|
|
152
167
|
"--types": {
|
|
153
168
|
type: Boolean,
|
|
154
|
-
description:
|
|
169
|
+
description: `Add TypeScript types for the \`${configs.tailwind}\` file`
|
|
155
170
|
},
|
|
156
171
|
"-f": "--full",
|
|
157
172
|
"-p": "--postcss"
|
|
@@ -216,16 +231,13 @@ let sharedFlags = {
|
|
|
216
231
|
},
|
|
217
232
|
"-h": "--help"
|
|
218
233
|
};
|
|
219
|
-
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined
|
|
220
|
-
))) {
|
|
234
|
+
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
|
|
221
235
|
help({
|
|
222
236
|
usage: [
|
|
223
237
|
"tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
|
|
224
238
|
"tailwindcss init [--full] [--postcss] [--types] [options...]",
|
|
225
239
|
],
|
|
226
|
-
commands: Object.keys(commands).filter((command2)=>command2 !== "build"
|
|
227
|
-
).map((command3)=>`${command3} [options]`
|
|
228
|
-
),
|
|
240
|
+
commands: Object.keys(commands).filter((command2)=>command2 !== "build").map((command3)=>`${command3} [options]`),
|
|
229
241
|
options: {
|
|
230
242
|
...commands.build.args,
|
|
231
243
|
...sharedFlags
|
|
@@ -233,8 +245,7 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
|
|
|
233
245
|
});
|
|
234
246
|
process.exit(0);
|
|
235
247
|
}
|
|
236
|
-
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg
|
|
237
|
-
)(process.argv[2]) || "build";
|
|
248
|
+
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
|
|
238
249
|
if (commands[command] === undefined) {
|
|
239
250
|
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
240
251
|
// TODO: Deprecate this in future versions
|
|
@@ -246,9 +257,7 @@ if (commands[command] === undefined) {
|
|
|
246
257
|
usage: [
|
|
247
258
|
"tailwindcss <command> [options]"
|
|
248
259
|
],
|
|
249
|
-
commands: Object.keys(commands).filter((command4)=>command4 !== "build"
|
|
250
|
-
).map((command5)=>`${command5} [options]`
|
|
251
|
-
),
|
|
260
|
+
commands: Object.keys(commands).filter((command4)=>command4 !== "build").map((command5)=>`${command5} [options]`),
|
|
252
261
|
options: sharedFlags
|
|
253
262
|
});
|
|
254
263
|
process.exit(1);
|
|
@@ -267,8 +276,7 @@ let args = (()=>{
|
|
|
267
276
|
}).map(([key, value])=>[
|
|
268
277
|
key,
|
|
269
278
|
typeof value === "object" ? value.type : value
|
|
270
|
-
]
|
|
271
|
-
)), {
|
|
279
|
+
])), {
|
|
272
280
|
permissive: true
|
|
273
281
|
});
|
|
274
282
|
// Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
|
|
@@ -335,7 +343,7 @@ run();
|
|
|
335
343
|
function init() {
|
|
336
344
|
let messages = [];
|
|
337
345
|
var ref;
|
|
338
|
-
let tailwindConfigLocation = _path.default.resolve((ref = args["_"][1]) !== null && ref !== void 0 ? ref :
|
|
346
|
+
let tailwindConfigLocation = _path.default.resolve((ref = args["_"][1]) !== null && ref !== void 0 ? ref : `./${configs.tailwind}`);
|
|
339
347
|
if (_fs.default.existsSync(tailwindConfigLocation)) {
|
|
340
348
|
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
|
341
349
|
} else {
|
|
@@ -350,7 +358,7 @@ function init() {
|
|
|
350
358
|
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
|
|
351
359
|
}
|
|
352
360
|
if (args["--postcss"]) {
|
|
353
|
-
let postcssConfigLocation = _path.default.resolve(
|
|
361
|
+
let postcssConfigLocation = _path.default.resolve(`./${configs.postcss}`);
|
|
354
362
|
if (_fs.default.existsSync(postcssConfigLocation)) {
|
|
355
363
|
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
|
356
364
|
} else {
|
|
@@ -389,8 +397,7 @@ async function build() {
|
|
|
389
397
|
console.error(`Specified config file ${args["--config"]} does not exist.`);
|
|
390
398
|
process.exit(9);
|
|
391
399
|
}
|
|
392
|
-
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null
|
|
393
|
-
)(_path.default.resolve("./tailwind.config.js"));
|
|
400
|
+
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve(`./${configs.tailwind}`));
|
|
394
401
|
async function loadPostCssPlugins() {
|
|
395
402
|
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
|
396
403
|
let config1 = customPostCssPath ? await (async ()=>{
|
|
@@ -448,9 +455,12 @@ async function build() {
|
|
|
448
455
|
}
|
|
449
456
|
});
|
|
450
457
|
resolvedConfig.content.files = files;
|
|
458
|
+
resolvedConfig = (0, _validateConfigJs).validateConfig(resolvedConfig);
|
|
451
459
|
return resolvedConfig;
|
|
452
460
|
}
|
|
453
|
-
|
|
461
|
+
let resolvedConfig = (0, _resolveConfig).default(config);
|
|
462
|
+
resolvedConfig = (0, _validateConfigJs).validateConfig(resolvedConfig);
|
|
463
|
+
return resolvedConfig;
|
|
454
464
|
}
|
|
455
465
|
function extractFileGlobs(config) {
|
|
456
466
|
return config.content.files.filter((file)=>{
|
|
@@ -458,8 +468,7 @@ async function build() {
|
|
|
458
468
|
// like an object it's probably a raw content object. But this object
|
|
459
469
|
// is not watchable, so let's remove it.
|
|
460
470
|
return typeof file === "string";
|
|
461
|
-
}).map((glob)=>(0, _normalizePath).default(glob)
|
|
462
|
-
);
|
|
471
|
+
}).map((glob)=>(0, _normalizePath).default(glob));
|
|
463
472
|
}
|
|
464
473
|
function extractRawContent(config) {
|
|
465
474
|
return config.content.files.filter((file)=>{
|
|
@@ -503,9 +512,16 @@ async function build() {
|
|
|
503
512
|
};
|
|
504
513
|
tailwindPlugin.postcss = true;
|
|
505
514
|
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins() : [
|
|
515
|
+
[
|
|
516
|
+
(()=>{
|
|
517
|
+
try {
|
|
518
|
+
return require("postcss-import");
|
|
519
|
+
} catch {}
|
|
520
|
+
return (0, _indexJs).lazyPostcssImport();
|
|
521
|
+
})(),
|
|
522
|
+
],
|
|
506
523
|
[],
|
|
507
|
-
|
|
508
|
-
{}
|
|
524
|
+
{},
|
|
509
525
|
];
|
|
510
526
|
let plugins = [
|
|
511
527
|
...beforePlugins,
|
|
@@ -541,13 +557,11 @@ async function build() {
|
|
|
541
557
|
let start = process.hrtime.bigint();
|
|
542
558
|
return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
543
559
|
recursive: true
|
|
544
|
-
}) : null
|
|
545
|
-
).then(()=>processor.process(css, {
|
|
560
|
+
}) : null).then(()=>processor.process(css, {
|
|
546
561
|
...postcssOptions,
|
|
547
562
|
from: input,
|
|
548
563
|
to: output
|
|
549
|
-
})
|
|
550
|
-
).then((result)=>{
|
|
564
|
+
})).then((result)=>{
|
|
551
565
|
if (!output) {
|
|
552
566
|
return process.stdout.write(result.css);
|
|
553
567
|
}
|
|
@@ -558,7 +572,7 @@ async function build() {
|
|
|
558
572
|
}).then(()=>{
|
|
559
573
|
let end = process.hrtime.bigint();
|
|
560
574
|
console.error();
|
|
561
|
-
console.error("Done in", (end - start) / BigInt(
|
|
575
|
+
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
|
562
576
|
});
|
|
563
577
|
}
|
|
564
578
|
let css1 = await (()=>{
|
|
@@ -587,8 +601,7 @@ async function build() {
|
|
|
587
601
|
delete require.cache[require.resolve(file1)];
|
|
588
602
|
}
|
|
589
603
|
if (configPath) {
|
|
590
|
-
configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file
|
|
591
|
-
);
|
|
604
|
+
configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file);
|
|
592
605
|
for (let dependency of configDependencies){
|
|
593
606
|
contextDependencies.add(dependency);
|
|
594
607
|
}
|
|
@@ -663,12 +676,10 @@ async function build() {
|
|
|
663
676
|
let start = process.hrtime.bigint();
|
|
664
677
|
return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
665
678
|
recursive: true
|
|
666
|
-
}) : null
|
|
667
|
-
).then(()=>processor.process(css, {
|
|
679
|
+
}) : null).then(()=>processor.process(css, {
|
|
668
680
|
from: input,
|
|
669
681
|
to: output
|
|
670
|
-
})
|
|
671
|
-
).then(async (result)=>{
|
|
682
|
+
})).then(async (result)=>{
|
|
672
683
|
for (let message of result.messages){
|
|
673
684
|
if (message.type === "dependency") {
|
|
674
685
|
contextDependencies.add(message.file);
|
|
@@ -686,7 +697,7 @@ async function build() {
|
|
|
686
697
|
].filter(Boolean));
|
|
687
698
|
}).then(()=>{
|
|
688
699
|
let end = process.hrtime.bigint();
|
|
689
|
-
console.error("Done in", (end - start) / BigInt(
|
|
700
|
+
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
|
690
701
|
}).catch((err)=>{
|
|
691
702
|
if (err.name === "CssSyntaxError") {
|
|
692
703
|
console.error(err.toString());
|
|
@@ -768,8 +779,7 @@ async function build() {
|
|
|
768
779
|
});
|
|
769
780
|
}
|
|
770
781
|
if (shouldWatch) {
|
|
771
|
-
/* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.on("end", ()=>process.exit(0)
|
|
772
|
-
);
|
|
782
|
+
/* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.on("end", ()=>process.exit(0));
|
|
773
783
|
process.stdin.resume();
|
|
774
784
|
startWatcher();
|
|
775
785
|
} else {
|
package/lib/corePlugins.js
CHANGED
|
@@ -19,31 +19,50 @@ var _packageJson = require("../package.json");
|
|
|
19
19
|
var _log = _interopRequireDefault(require("./util/log"));
|
|
20
20
|
var _normalizeScreens = require("./util/normalizeScreens");
|
|
21
21
|
var _parseBoxShadowValue = require("./util/parseBoxShadowValue");
|
|
22
|
+
var _featureFlags = require("./featureFlags");
|
|
22
23
|
function _interopRequireDefault(obj) {
|
|
23
24
|
return obj && obj.__esModule ? obj : {
|
|
24
25
|
default: obj
|
|
25
26
|
};
|
|
26
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
|
+
}
|
|
27
36
|
function _interopRequireWildcard(obj) {
|
|
28
37
|
if (obj && obj.__esModule) {
|
|
29
38
|
return obj;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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];
|
|
42
58
|
}
|
|
43
59
|
}
|
|
44
|
-
newObj.default = obj;
|
|
45
|
-
return newObj;
|
|
46
60
|
}
|
|
61
|
+
newObj.default = obj;
|
|
62
|
+
if (cache) {
|
|
63
|
+
cache.set(obj, newObj);
|
|
64
|
+
}
|
|
65
|
+
return newObj;
|
|
47
66
|
}
|
|
48
67
|
let variantPlugins = {
|
|
49
68
|
pseudoElementVariants: ({ addVariant })=>{
|
|
@@ -91,28 +110,28 @@ let variantPlugins = {
|
|
|
91
110
|
return "&::after";
|
|
92
111
|
});
|
|
93
112
|
},
|
|
94
|
-
pseudoClassVariants: ({ addVariant })=>{
|
|
113
|
+
pseudoClassVariants: ({ addVariant , config })=>{
|
|
95
114
|
let pseudoVariants = [
|
|
96
115
|
// Positional
|
|
97
116
|
[
|
|
98
117
|
"first",
|
|
99
|
-
"
|
|
118
|
+
"&:first-child"
|
|
100
119
|
],
|
|
101
120
|
[
|
|
102
121
|
"last",
|
|
103
|
-
"
|
|
122
|
+
"&:last-child"
|
|
104
123
|
],
|
|
105
124
|
[
|
|
106
125
|
"only",
|
|
107
|
-
"
|
|
126
|
+
"&:only-child"
|
|
108
127
|
],
|
|
109
128
|
[
|
|
110
129
|
"odd",
|
|
111
|
-
"
|
|
130
|
+
"&:nth-child(odd)"
|
|
112
131
|
],
|
|
113
132
|
[
|
|
114
133
|
"even",
|
|
115
|
-
"
|
|
134
|
+
"&:nth-child(even)"
|
|
116
135
|
],
|
|
117
136
|
"first-of-type",
|
|
118
137
|
"last-of-type",
|
|
@@ -137,13 +156,13 @@ let variantPlugins = {
|
|
|
137
156
|
}
|
|
138
157
|
}
|
|
139
158
|
});
|
|
140
|
-
return "
|
|
159
|
+
return "&:visited";
|
|
141
160
|
},
|
|
142
161
|
],
|
|
143
162
|
"target",
|
|
144
163
|
[
|
|
145
164
|
"open",
|
|
146
|
-
"[open]"
|
|
165
|
+
"&[open]"
|
|
147
166
|
],
|
|
148
167
|
// Forms
|
|
149
168
|
"default",
|
|
@@ -151,6 +170,7 @@ let variantPlugins = {
|
|
|
151
170
|
"indeterminate",
|
|
152
171
|
"placeholder-shown",
|
|
153
172
|
"autofill",
|
|
173
|
+
"optional",
|
|
154
174
|
"required",
|
|
155
175
|
"valid",
|
|
156
176
|
"invalid",
|
|
@@ -161,7 +181,10 @@ let variantPlugins = {
|
|
|
161
181
|
"empty",
|
|
162
182
|
// Interactive
|
|
163
183
|
"focus-within",
|
|
164
|
-
|
|
184
|
+
[
|
|
185
|
+
"hover",
|
|
186
|
+
!(0, _featureFlags).flagEnabled(config(), "hoverOnlyWhenSupported") ? "&:hover" : "@media (hover: hover) and (pointer: fine) { &:hover }",
|
|
187
|
+
],
|
|
165
188
|
"focus",
|
|
166
189
|
"focus-visible",
|
|
167
190
|
"active",
|
|
@@ -169,25 +192,24 @@ let variantPlugins = {
|
|
|
169
192
|
"disabled",
|
|
170
193
|
].map((variant)=>Array.isArray(variant) ? variant : [
|
|
171
194
|
variant,
|
|
172
|
-
|
|
173
|
-
]
|
|
174
|
-
);
|
|
195
|
+
`&:${variant}`
|
|
196
|
+
]);
|
|
175
197
|
for (let [variantName, state] of pseudoVariants){
|
|
176
198
|
addVariant(variantName, (ctx)=>{
|
|
177
199
|
let result = typeof state === "function" ? state(ctx) : state;
|
|
178
|
-
return
|
|
200
|
+
return result;
|
|
179
201
|
});
|
|
180
202
|
}
|
|
181
203
|
for (let [variantName1, state1] of pseudoVariants){
|
|
182
204
|
addVariant(`group-${variantName1}`, (ctx)=>{
|
|
183
205
|
let result = typeof state1 === "function" ? state1(ctx) : state1;
|
|
184
|
-
return
|
|
206
|
+
return result.replace(/&(\S+)/, ":merge(.group)$1 &");
|
|
185
207
|
});
|
|
186
208
|
}
|
|
187
209
|
for (let [variantName2, state2] of pseudoVariants){
|
|
188
210
|
addVariant(`peer-${variantName2}`, (ctx)=>{
|
|
189
211
|
let result = typeof state2 === "function" ? state2(ctx) : state2;
|
|
190
|
-
return
|
|
212
|
+
return result.replace(/&(\S+)/, ":merge(.peer)$1 ~ &");
|
|
191
213
|
});
|
|
192
214
|
}
|
|
193
215
|
},
|
|
@@ -239,6 +261,10 @@ let variantPlugins = {
|
|
|
239
261
|
orientationVariants: ({ addVariant })=>{
|
|
240
262
|
addVariant("portrait", "@media (orientation: portrait)");
|
|
241
263
|
addVariant("landscape", "@media (orientation: landscape)");
|
|
264
|
+
},
|
|
265
|
+
prefersContrastVariants: ({ addVariant })=>{
|
|
266
|
+
addVariant("contrast-more", "@media (prefers-contrast: more)");
|
|
267
|
+
addVariant("contrast-less", "@media (prefers-contrast: less)");
|
|
242
268
|
}
|
|
243
269
|
};
|
|
244
270
|
exports.variantPlugins = variantPlugins;
|
|
@@ -284,10 +310,7 @@ let corePlugins = {
|
|
|
284
310
|
},
|
|
285
311
|
container: (()=>{
|
|
286
312
|
function extractMinWidths(breakpoints = []) {
|
|
287
|
-
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min
|
|
288
|
-
)
|
|
289
|
-
).filter((v)=>v !== undefined
|
|
290
|
-
);
|
|
313
|
+
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min)).filter((v)=>v !== undefined);
|
|
291
314
|
}
|
|
292
315
|
function mapMinWidthsToPadding(minWidths, screens, paddings) {
|
|
293
316
|
if (typeof paddings === "undefined") {
|
|
@@ -329,8 +352,7 @@ let corePlugins = {
|
|
|
329
352
|
let minWidths = extractMinWidths(screens);
|
|
330
353
|
let paddings = mapMinWidthsToPadding(minWidths, screens, theme("container.padding"));
|
|
331
354
|
let generatePaddingFor = (minWidth)=>{
|
|
332
|
-
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth
|
|
333
|
-
);
|
|
355
|
+
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth);
|
|
334
356
|
if (!paddingConfig) {
|
|
335
357
|
return {};
|
|
336
358
|
}
|
|
@@ -339,16 +361,14 @@ let corePlugins = {
|
|
|
339
361
|
paddingLeft: paddingConfig.padding
|
|
340
362
|
};
|
|
341
363
|
};
|
|
342
|
-
let atRules = Array.from(new Set(minWidths.slice().sort((a, z)=>parseInt(a) - parseInt(z)
|
|
343
|
-
))).map((minWidth)=>({
|
|
364
|
+
let atRules = Array.from(new Set(minWidths.slice().sort((a, z)=>parseInt(a) - parseInt(z)))).map((minWidth)=>({
|
|
344
365
|
[`@media (min-width: ${minWidth})`]: {
|
|
345
366
|
".container": {
|
|
346
367
|
"max-width": minWidth,
|
|
347
368
|
...generatePaddingFor(minWidth)
|
|
348
369
|
}
|
|
349
370
|
}
|
|
350
|
-
})
|
|
351
|
-
);
|
|
371
|
+
}));
|
|
352
372
|
addComponents([
|
|
353
373
|
{
|
|
354
374
|
".container": Object.assign({
|
|
@@ -1025,8 +1045,7 @@ let corePlugins = {
|
|
|
1025
1045
|
});
|
|
1026
1046
|
},
|
|
1027
1047
|
animation: ({ matchUtilities , theme , config })=>{
|
|
1028
|
-
let prefixName = (name)=>`${config("prefix")}${(0, _escapeClassName).default(name)}
|
|
1029
|
-
;
|
|
1048
|
+
let prefixName = (name)=>`${config("prefix")}${(0, _escapeClassName).default(name)}`;
|
|
1030
1049
|
var ref;
|
|
1031
1050
|
let keyframes = Object.fromEntries(Object.entries((ref = theme("keyframes")) !== null && ref !== void 0 ? ref : {}).map(([key, value])=>{
|
|
1032
1051
|
return [
|
|
@@ -1040,8 +1059,7 @@ let corePlugins = {
|
|
|
1040
1059
|
animate: (value1)=>{
|
|
1041
1060
|
let animations = (0, _parseAnimationValue).default(value1);
|
|
1042
1061
|
return [
|
|
1043
|
-
...animations.flatMap((animation)=>keyframes[animation.name]
|
|
1044
|
-
),
|
|
1062
|
+
...animations.flatMap((animation)=>keyframes[animation.name]),
|
|
1045
1063
|
{
|
|
1046
1064
|
animation: animations.map(({ name , value })=>{
|
|
1047
1065
|
if (name === undefined || keyframes[name] === undefined) {
|
|
@@ -1741,8 +1759,7 @@ let corePlugins = {
|
|
|
1741
1759
|
};
|
|
1742
1760
|
}
|
|
1743
1761
|
}, {
|
|
1744
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
1745
|
-
)((0, _flattenColorPalette).default(theme("divideColor"))),
|
|
1762
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("divideColor"))),
|
|
1746
1763
|
type: "color"
|
|
1747
1764
|
});
|
|
1748
1765
|
},
|
|
@@ -2144,8 +2161,7 @@ let corePlugins = {
|
|
|
2144
2161
|
});
|
|
2145
2162
|
}
|
|
2146
2163
|
}, {
|
|
2147
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2148
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2164
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2149
2165
|
type: [
|
|
2150
2166
|
"color"
|
|
2151
2167
|
]
|
|
@@ -2184,8 +2200,7 @@ let corePlugins = {
|
|
|
2184
2200
|
});
|
|
2185
2201
|
}
|
|
2186
2202
|
}, {
|
|
2187
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2188
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2203
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2189
2204
|
type: "color"
|
|
2190
2205
|
});
|
|
2191
2206
|
matchUtilities({
|
|
@@ -2238,8 +2253,7 @@ let corePlugins = {
|
|
|
2238
2253
|
});
|
|
2239
2254
|
}
|
|
2240
2255
|
}, {
|
|
2241
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2242
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2256
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2243
2257
|
type: "color"
|
|
2244
2258
|
});
|
|
2245
2259
|
},
|
|
@@ -2309,7 +2323,8 @@ let corePlugins = {
|
|
|
2309
2323
|
let transparentToValue = transparentTo(value);
|
|
2310
2324
|
return {
|
|
2311
2325
|
"--tw-gradient-from": (0, _toColorValue).default(value, "from"),
|
|
2312
|
-
"--tw-gradient-
|
|
2326
|
+
"--tw-gradient-to": transparentToValue,
|
|
2327
|
+
"--tw-gradient-stops": `var(--tw-gradient-from), var(--tw-gradient-to)`
|
|
2313
2328
|
};
|
|
2314
2329
|
}
|
|
2315
2330
|
}, options);
|
|
@@ -2317,7 +2332,8 @@ let corePlugins = {
|
|
|
2317
2332
|
via: (value)=>{
|
|
2318
2333
|
let transparentToValue = transparentTo(value);
|
|
2319
2334
|
return {
|
|
2320
|
-
"--tw-gradient-
|
|
2335
|
+
"--tw-gradient-to": transparentToValue,
|
|
2336
|
+
"--tw-gradient-stops": `var(--tw-gradient-from), ${(0, _toColorValue).default(value, "via")}, var(--tw-gradient-to)`
|
|
2321
2337
|
};
|
|
2322
2338
|
}
|
|
2323
2339
|
}, options);
|
|
@@ -3194,10 +3210,18 @@ let corePlugins = {
|
|
|
3194
3210
|
]
|
|
3195
3211
|
});
|
|
3196
3212
|
},
|
|
3197
|
-
ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme })=>{
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3213
|
+
ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme , config })=>{
|
|
3214
|
+
let ringColorDefault = (()=>{
|
|
3215
|
+
var ref, ref1;
|
|
3216
|
+
if ((0, _featureFlags).flagEnabled(config(), "respectDefaultRingColorOpacity")) {
|
|
3217
|
+
return theme("ringColor.DEFAULT");
|
|
3218
|
+
}
|
|
3219
|
+
let ringOpacityDefault = theme("ringOpacity.DEFAULT", "0.5");
|
|
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})`);
|
|
3224
|
+
})();
|
|
3201
3225
|
addDefaults("ring-width", {
|
|
3202
3226
|
"--tw-ring-inset": " ",
|
|
3203
3227
|
"--tw-ring-offset-width": theme("ringOffsetWidth.DEFAULT", "0px"),
|
|
@@ -3247,21 +3271,23 @@ let corePlugins = {
|
|
|
3247
3271
|
});
|
|
3248
3272
|
}
|
|
3249
3273
|
}, {
|
|
3250
|
-
values: Object.fromEntries(Object.entries((0, _flattenColorPalette).default(theme("ringColor"))).filter(([modifier])=>modifier !== "DEFAULT"
|
|
3251
|
-
)),
|
|
3274
|
+
values: Object.fromEntries(Object.entries((0, _flattenColorPalette).default(theme("ringColor"))).filter(([modifier])=>modifier !== "DEFAULT")),
|
|
3252
3275
|
type: "color"
|
|
3253
3276
|
});
|
|
3254
3277
|
},
|
|
3255
|
-
ringOpacity: (
|
|
3256
|
-
|
|
3257
|
-
|
|
3278
|
+
ringOpacity: (helpers)=>{
|
|
3279
|
+
let { config } = helpers;
|
|
3280
|
+
return (0, _createUtilityPlugin).default("ringOpacity", [
|
|
3258
3281
|
[
|
|
3259
|
-
"
|
|
3282
|
+
"ring-opacity",
|
|
3283
|
+
[
|
|
3284
|
+
"--tw-ring-opacity"
|
|
3285
|
+
]
|
|
3260
3286
|
]
|
|
3261
|
-
]
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
}
|
|
3287
|
+
], {
|
|
3288
|
+
filterDefault: !(0, _featureFlags).flagEnabled(config(), "respectDefaultRingColorOpacity")
|
|
3289
|
+
})(helpers);
|
|
3290
|
+
},
|
|
3265
3291
|
ringOffsetWidth: (0, _createUtilityPlugin).default("ringOffsetWidth", [
|
|
3266
3292
|
[
|
|
3267
3293
|
"ring-offset",
|
|
@@ -3327,8 +3353,7 @@ let corePlugins = {
|
|
|
3327
3353
|
matchUtilities({
|
|
3328
3354
|
"drop-shadow": (value)=>{
|
|
3329
3355
|
return {
|
|
3330
|
-
"--tw-drop-shadow": Array.isArray(value) ? value.map((v)=>`drop-shadow(${v})`
|
|
3331
|
-
).join(" ") : `drop-shadow(${value})`,
|
|
3356
|
+
"--tw-drop-shadow": Array.isArray(value) ? value.map((v)=>`drop-shadow(${v})`).join(" ") : `drop-shadow(${value})`,
|
|
3332
3357
|
"@defaults filter": {},
|
|
3333
3358
|
filter: cssFilterValue
|
|
3334
3359
|
};
|