tailwindcss 0.0.0-insiders.89c7f7d → 0.0.0-insiders.8a4b2f0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -3
- package/colors.js +2 -1
- package/defaultConfig.js +2 -1
- package/defaultTheme.js +2 -1
- package/lib/cli.js +58 -58
- package/lib/corePlugins.js +22 -20
- package/lib/lib/expandApplyAtRules.js +23 -6
- package/lib/lib/resolveDefaultsAtRules.js +23 -9
- package/lib/util/dataTypes.js +14 -3
- package/lib/util/normalizeScreens.js +5 -2
- package/lib/util/resolveConfig.js +8 -8
- package/package.json +10 -10
- package/peers/index.js +734 -642
- package/plugin.js +2 -1
- package/resolveConfig.js +2 -1
- package/src/corePlugins.js +19 -15
- package/src/lib/expandApplyAtRules.js +29 -2
- package/src/lib/resolveDefaultsAtRules.js +28 -7
- package/src/util/dataTypes.js +11 -6
- package/src/util/normalizeScreens.js +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
- Nothing yet!
|
|
11
|
+
|
|
12
|
+
## [3.0.1] - 2021-12-10
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Ensure complex variants with multiple classes work ([#6311](https://github.com/tailwindlabs/tailwindcss/pull/6311))
|
|
17
|
+
- Re-add `default` interop to public available functions ([#6348](https://github.com/tailwindlabs/tailwindcss/pull/6348))
|
|
18
|
+
- Detect circular dependencies when using `@apply` ([#6365](https://github.com/tailwindlabs/tailwindcss/pull/6365))
|
|
19
|
+
- Fix defaults optimization when vendor prefixes are involved ([#6369](https://github.com/tailwindlabs/tailwindcss/pull/6369))
|
|
20
|
+
|
|
21
|
+
## [3.0.0] - 2021-12-09
|
|
22
|
+
|
|
10
23
|
### Fixed
|
|
11
24
|
|
|
12
25
|
- Enforce the order of some variants (like `before` and `after`) ([#6018](https://github.com/tailwindlabs/tailwindcss/pull/6018))
|
|
@@ -14,12 +27,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
14
27
|
### Added
|
|
15
28
|
|
|
16
29
|
- Add `placeholder` variant ([#6106](https://github.com/tailwindlabs/tailwindcss/pull/6106))
|
|
17
|
-
- Add
|
|
18
|
-
- Add combinable `touch-action` support ([#6115](https://github.com/tailwindlabs/tailwindcss/pull/6115))
|
|
30
|
+
- Add composable `touch-action` utilities ([#6115](https://github.com/tailwindlabs/tailwindcss/pull/6115))
|
|
19
31
|
- Add support for "arbitrary properties" ([#6161](https://github.com/tailwindlabs/tailwindcss/pull/6161))
|
|
20
32
|
- Add `portrait` and `landscape` variants ([#6046](https://github.com/tailwindlabs/tailwindcss/pull/6046))
|
|
21
33
|
- Add `text-decoration-style`, `text-decoration-thickness`, and `text-underline-offset` utilities ([#6004](https://github.com/tailwindlabs/tailwindcss/pull/6004))
|
|
22
34
|
- Add `menu` reset to preflight ([#6213](https://github.com/tailwindlabs/tailwindcss/pull/6213))
|
|
35
|
+
- Allow `0` as a valid `length` value ([#6233](https://github.com/tailwindlabs/tailwindcss/pull/6233), [#6259](https://github.com/tailwindlabs/tailwindcss/pull/6259))
|
|
36
|
+
- Add CSS functions to data types ([#6258](https://github.com/tailwindlabs/tailwindcss/pull/6258))
|
|
37
|
+
- Support negative values for `scale-*` utilities ([c48e629](https://github.com/tailwindlabs/tailwindcss/commit/c48e629955585ad18dadba9f470fda59cc448ab7))
|
|
38
|
+
- Improve `length` data type, by validating each value individually ([#6283](https://github.com/tailwindlabs/tailwindcss/pull/6283))
|
|
23
39
|
|
|
24
40
|
### Changed
|
|
25
41
|
|
|
@@ -44,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
44
60
|
- Add `text-decoration-color` utilities ([#5760](https://github.com/tailwindlabs/tailwindcss/pull/5760))
|
|
45
61
|
- Add new declarative `addVariant` API ([#5809](https://github.com/tailwindlabs/tailwindcss/pull/5809))
|
|
46
62
|
- Add first-class `print` variant for targeting printed media ([#5885](https://github.com/tailwindlabs/tailwindcss/pull/5885))
|
|
63
|
+
- Add `outline-style`, `outline-color`, `outline-width` and `outline-offset` utilities ([#5887](https://github.com/tailwindlabs/tailwindcss/pull/5887))
|
|
47
64
|
- Add full color palette for `fill-*` and `stroke-*` utilities (#5933[](https://github.com/tailwindlabs/tailwindcss/pull/5933))
|
|
48
65
|
- Add composable API for colored box shadows ([#5979](https://github.com/tailwindlabs/tailwindcss/pull/5979))
|
|
49
66
|
|
|
@@ -1673,7 +1690,9 @@ No release notes
|
|
|
1673
1690
|
|
|
1674
1691
|
- Everything!
|
|
1675
1692
|
|
|
1676
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.
|
|
1693
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.1...HEAD
|
|
1694
|
+
[3.0.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0...v3.0.1
|
|
1695
|
+
[3.0.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.2...v3.0.0
|
|
1677
1696
|
[3.0.0-alpha.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.1...v3.0.0-alpha.2
|
|
1678
1697
|
[3.0.0-alpha.1]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.19...v3.0.0-alpha.1
|
|
1679
1698
|
[2.2.19]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.18...v2.2.19
|
package/colors.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
let colors = require('./lib/public/colors')
|
|
2
|
+
module.exports = (colors.__esModule ? colors : { default: colors }).default
|
package/defaultConfig.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
let defaultConfig = require('./lib/public/default-config')
|
|
2
|
+
module.exports = (defaultConfig.__esModule ? defaultConfig : { default: defaultConfig }).default
|
package/defaultTheme.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
let defaultTheme = require('./lib/public/default-theme')
|
|
2
|
+
module.exports = (defaultTheme.__esModule ? defaultTheme : { default: defaultTheme }).default
|
package/lib/cli.js
CHANGED
|
@@ -40,7 +40,7 @@ function formatNodes(root) {
|
|
|
40
40
|
root.first.raws.before = '';
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function help({ message , usage , commands , options }) {
|
|
43
|
+
function help({ message , usage , commands: commands1 , options }) {
|
|
44
44
|
let indent = 2;
|
|
45
45
|
// Render header
|
|
46
46
|
console.log();
|
|
@@ -61,11 +61,11 @@ function help({ message , usage , commands , options }) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
// Render commands
|
|
64
|
-
if (
|
|
64
|
+
if (commands1 && commands1.length > 0) {
|
|
65
65
|
console.log();
|
|
66
66
|
console.log('Commands:');
|
|
67
|
-
for (let
|
|
68
|
-
console.log(' '.repeat(indent),
|
|
67
|
+
for (let command1 of commands1){
|
|
68
|
+
console.log(' '.repeat(indent), command1);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
// Render options
|
|
@@ -86,12 +86,12 @@ function help({ message , usage , commands , options }) {
|
|
|
86
86
|
}
|
|
87
87
|
console.log();
|
|
88
88
|
console.log('Options:');
|
|
89
|
-
for (let { flags , description , deprecated } of Object.values(groupedOptions)){
|
|
89
|
+
for (let { flags: flags1 , description , deprecated } of Object.values(groupedOptions)){
|
|
90
90
|
if (deprecated) continue;
|
|
91
|
-
if (
|
|
92
|
-
console.log(' '.repeat(indent + 4 /* 4 = "-i, ".length */ ),
|
|
91
|
+
if (flags1.length === 1) {
|
|
92
|
+
console.log(' '.repeat(indent + 4 /* 4 = "-i, ".length */ ), flags1.slice().reverse().join(', ').padEnd(20, ' '), description);
|
|
93
93
|
} else {
|
|
94
|
-
console.log(' '.repeat(indent),
|
|
94
|
+
console.log(' '.repeat(indent), flags1.slice().reverse().join(', ').padEnd(24, ' '), description);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -110,7 +110,7 @@ function oneOf(...options) {
|
|
|
110
110
|
manualParsing: true
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
let
|
|
113
|
+
let commands = {
|
|
114
114
|
init: {
|
|
115
115
|
run: init,
|
|
116
116
|
args: {
|
|
@@ -187,31 +187,31 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
|
|
|
187
187
|
'tailwindcss [--input input.css] [--output output.css] [--watch] [options...]',
|
|
188
188
|
'tailwindcss init [--full] [--postcss] [options...]',
|
|
189
189
|
],
|
|
190
|
-
commands: Object.keys(
|
|
191
|
-
).map((
|
|
190
|
+
commands: Object.keys(commands).filter((command2)=>command2 !== 'build'
|
|
191
|
+
).map((command3)=>`${command3} [options]`
|
|
192
192
|
),
|
|
193
193
|
options: {
|
|
194
|
-
...
|
|
194
|
+
...commands.build.args,
|
|
195
195
|
...sharedFlags
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
198
|
process.exit(0);
|
|
199
199
|
}
|
|
200
|
-
let
|
|
200
|
+
let command = ((arg = '')=>arg.startsWith('-') ? undefined : arg
|
|
201
201
|
)(process.argv[2]) || 'build';
|
|
202
|
-
if (
|
|
203
|
-
if (_fs.default.existsSync(_path.default.resolve(
|
|
202
|
+
if (commands[command] === undefined) {
|
|
203
|
+
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
204
204
|
// TODO: Deprecate this in future versions
|
|
205
205
|
// Check if non-existing command, might be a file.
|
|
206
|
-
|
|
206
|
+
command = 'build';
|
|
207
207
|
} else {
|
|
208
208
|
help({
|
|
209
|
-
message: `Invalid command: ${
|
|
209
|
+
message: `Invalid command: ${command}`,
|
|
210
210
|
usage: [
|
|
211
211
|
'tailwindcss <command> [options]'
|
|
212
212
|
],
|
|
213
|
-
commands: Object.keys(
|
|
214
|
-
).map((
|
|
213
|
+
commands: Object.keys(commands).filter((command4)=>command4 !== 'build'
|
|
214
|
+
).map((command5)=>`${command5} [options]`
|
|
215
215
|
),
|
|
216
216
|
options: sharedFlags
|
|
217
217
|
});
|
|
@@ -219,11 +219,11 @@ if (commands1[command1] === undefined) {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
// Execute command
|
|
222
|
-
let { args:
|
|
223
|
-
let
|
|
222
|
+
let { args: flags , run } = commands[command];
|
|
223
|
+
let args = (()=>{
|
|
224
224
|
try {
|
|
225
225
|
let result = (0, _arg).default(Object.fromEntries(Object.entries({
|
|
226
|
-
...
|
|
226
|
+
...flags,
|
|
227
227
|
...sharedFlags
|
|
228
228
|
}).filter(([_key, value])=>{
|
|
229
229
|
var ref;
|
|
@@ -240,23 +240,23 @@ let args1 = (()=>{
|
|
|
240
240
|
let flag = result['_'][i];
|
|
241
241
|
if (!flag.startsWith('-')) continue;
|
|
242
242
|
let flagName = flag;
|
|
243
|
-
let handler =
|
|
243
|
+
let handler = flags[flag];
|
|
244
244
|
// Resolve flagName & handler
|
|
245
245
|
while(typeof handler === 'string'){
|
|
246
246
|
flagName = handler;
|
|
247
|
-
handler =
|
|
247
|
+
handler = flags[handler];
|
|
248
248
|
}
|
|
249
249
|
if (!handler) continue;
|
|
250
|
-
let
|
|
250
|
+
let args1 = [];
|
|
251
251
|
let offset = i + 1;
|
|
252
252
|
// Parse args for current flag
|
|
253
253
|
while(result['_'][offset] && !result['_'][offset].startsWith('-')){
|
|
254
|
-
|
|
254
|
+
args1.push(result['_'][offset++]);
|
|
255
255
|
}
|
|
256
256
|
// Cleanup manually parsed flags + args
|
|
257
|
-
result['_'].splice(i, 1 +
|
|
257
|
+
result['_'].splice(i, 1 + args1.length);
|
|
258
258
|
// Set the resolved value in the `result` object
|
|
259
|
-
result[flagName] = handler.type(
|
|
259
|
+
result[flagName] = handler.type(args1.length === 0 ? undefined : args1.length === 1 ? args1[0] : args1, flagName);
|
|
260
260
|
}
|
|
261
261
|
// Ensure that the `command` is always the first argument in the `args`.
|
|
262
262
|
// This is important so that we don't have to check if a default command
|
|
@@ -264,8 +264,8 @@ let args1 = (()=>{
|
|
|
264
264
|
//
|
|
265
265
|
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
|
|
266
266
|
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
|
|
267
|
-
if (result['_'][0] !==
|
|
268
|
-
result['_'].unshift(
|
|
267
|
+
if (result['_'][0] !== command) {
|
|
268
|
+
result['_'].unshift(command);
|
|
269
269
|
}
|
|
270
270
|
return result;
|
|
271
271
|
} catch (err) {
|
|
@@ -282,14 +282,14 @@ let args1 = (()=>{
|
|
|
282
282
|
throw err;
|
|
283
283
|
}
|
|
284
284
|
})();
|
|
285
|
-
if (
|
|
285
|
+
if (args['--help']) {
|
|
286
286
|
help({
|
|
287
287
|
options: {
|
|
288
|
-
...
|
|
288
|
+
...flags,
|
|
289
289
|
...sharedFlags
|
|
290
290
|
},
|
|
291
291
|
usage: [
|
|
292
|
-
`tailwindcss ${
|
|
292
|
+
`tailwindcss ${command} [options]`
|
|
293
293
|
]
|
|
294
294
|
});
|
|
295
295
|
process.exit(0);
|
|
@@ -299,17 +299,17 @@ run();
|
|
|
299
299
|
function init() {
|
|
300
300
|
let messages = [];
|
|
301
301
|
var ref;
|
|
302
|
-
let tailwindConfigLocation = _path.default.resolve((ref =
|
|
302
|
+
let tailwindConfigLocation = _path.default.resolve((ref = args['_'][1]) !== null && ref !== void 0 ? ref : './tailwind.config.js');
|
|
303
303
|
if (_fs.default.existsSync(tailwindConfigLocation)) {
|
|
304
304
|
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
|
305
305
|
} else {
|
|
306
|
-
let stubFile = _fs.default.readFileSync(
|
|
306
|
+
let stubFile = _fs.default.readFileSync(args['--full'] ? _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js') : _path.default.resolve(__dirname, '../stubs/simpleConfig.stub.js'), 'utf8');
|
|
307
307
|
// Change colors import
|
|
308
308
|
stubFile = stubFile.replace('../colors', 'tailwindcss/colors');
|
|
309
309
|
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, 'utf8');
|
|
310
310
|
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
|
|
311
311
|
}
|
|
312
|
-
if (
|
|
312
|
+
if (args['--postcss']) {
|
|
313
313
|
let postcssConfigLocation = _path.default.resolve('./postcss.config.js');
|
|
314
314
|
if (_fs.default.existsSync(postcssConfigLocation)) {
|
|
315
315
|
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
|
@@ -327,27 +327,27 @@ function init() {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
async function build() {
|
|
330
|
-
let input =
|
|
331
|
-
let output =
|
|
332
|
-
let shouldWatch =
|
|
333
|
-
let includePostCss =
|
|
330
|
+
let input = args['--input'];
|
|
331
|
+
let output = args['--output'];
|
|
332
|
+
let shouldWatch = args['--watch'];
|
|
333
|
+
let includePostCss = args['--postcss'];
|
|
334
334
|
// TODO: Deprecate this in future versions
|
|
335
|
-
if (!input &&
|
|
335
|
+
if (!input && args['_'][1]) {
|
|
336
336
|
console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
|
|
337
|
-
input =
|
|
337
|
+
input = args['--input'] = args['_'][1];
|
|
338
338
|
}
|
|
339
339
|
if (input && !_fs.default.existsSync(input = _path.default.resolve(input))) {
|
|
340
|
-
console.error(`Specified input file ${
|
|
340
|
+
console.error(`Specified input file ${args['--input']} does not exist.`);
|
|
341
341
|
process.exit(9);
|
|
342
342
|
}
|
|
343
|
-
if (
|
|
344
|
-
console.error(`Specified config file ${
|
|
343
|
+
if (args['--config'] && !_fs.default.existsSync(args['--config'] = _path.default.resolve(args['--config']))) {
|
|
344
|
+
console.error(`Specified config file ${args['--config']} does not exist.`);
|
|
345
345
|
process.exit(9);
|
|
346
346
|
}
|
|
347
|
-
let configPath =
|
|
347
|
+
let configPath = args['--config'] ? args['--config'] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null
|
|
348
348
|
)(_path.default.resolve('./tailwind.config.js'));
|
|
349
349
|
async function loadPostCssPlugins() {
|
|
350
|
-
let customPostCssPath = typeof
|
|
350
|
+
let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined;
|
|
351
351
|
let { plugins: configPlugins } = customPostCssPath ? await (async ()=>{
|
|
352
352
|
let file = _path.default.resolve(customPostCssPath);
|
|
353
353
|
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.0.1/src/index.js
|
|
@@ -386,17 +386,17 @@ async function build() {
|
|
|
386
386
|
let config = configPath ? require(configPath) : {
|
|
387
387
|
};
|
|
388
388
|
let resolvedConfig = (0, _resolveConfig).default(config);
|
|
389
|
-
if (
|
|
389
|
+
if (args['--purge']) {
|
|
390
390
|
_log.default.warn('purge-flag-deprecated', [
|
|
391
391
|
'The `--purge` flag has been deprecated.',
|
|
392
392
|
'Please use `--content` instead.',
|
|
393
393
|
]);
|
|
394
|
-
if (!
|
|
395
|
-
|
|
394
|
+
if (!args['--content']) {
|
|
395
|
+
args['--content'] = args['--purge'];
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
if (
|
|
399
|
-
resolvedConfig.content.files =
|
|
398
|
+
if (args['--content']) {
|
|
399
|
+
resolvedConfig.content.files = args['--content'].split(/(?<!{[^}]+),/);
|
|
400
400
|
}
|
|
401
401
|
return resolvedConfig;
|
|
402
402
|
}
|
|
@@ -457,9 +457,9 @@ async function build() {
|
|
|
457
457
|
let plugins = [
|
|
458
458
|
...beforePlugins,
|
|
459
459
|
tailwindPlugin,
|
|
460
|
-
!
|
|
460
|
+
!args['--minify'] && formatNodes,
|
|
461
461
|
...afterPlugins,
|
|
462
|
-
!
|
|
462
|
+
!args['--no-autoprefixer'] && (()=>{
|
|
463
463
|
// Try to load a local `autoprefixer` version first
|
|
464
464
|
try {
|
|
465
465
|
return require('autoprefixer');
|
|
@@ -467,7 +467,7 @@ async function build() {
|
|
|
467
467
|
}
|
|
468
468
|
return (0, _indexJs).lazyAutoprefixer();
|
|
469
469
|
})(),
|
|
470
|
-
|
|
470
|
+
args['--minify'] && (()=>{
|
|
471
471
|
let options = {
|
|
472
472
|
preset: [
|
|
473
473
|
'default',
|
|
@@ -541,9 +541,9 @@ async function build() {
|
|
|
541
541
|
let plugins = [
|
|
542
542
|
...beforePlugins,
|
|
543
543
|
'__TAILWIND_PLUGIN_POSITION__',
|
|
544
|
-
!
|
|
544
|
+
!args['--minify'] && formatNodes,
|
|
545
545
|
...afterPlugins,
|
|
546
|
-
!
|
|
546
|
+
!args['--no-autoprefixer'] && (()=>{
|
|
547
547
|
// Try to load a local `autoprefixer` version first
|
|
548
548
|
try {
|
|
549
549
|
return require('autoprefixer');
|
|
@@ -551,7 +551,7 @@ async function build() {
|
|
|
551
551
|
}
|
|
552
552
|
return (0, _indexJs).lazyAutoprefixer();
|
|
553
553
|
})(),
|
|
554
|
-
|
|
554
|
+
args['--minify'] && (()=>{
|
|
555
555
|
let options = {
|
|
556
556
|
preset: [
|
|
557
557
|
'default',
|
package/lib/corePlugins.js
CHANGED
|
@@ -210,7 +210,7 @@ let variantPlugins = {
|
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
212
|
exports.variantPlugins = variantPlugins;
|
|
213
|
-
let
|
|
213
|
+
let corePlugins = {
|
|
214
214
|
preflight: ({ addBase })=>{
|
|
215
215
|
let preflightStyles = _postcss.default.parse(_fs.default.readFileSync(path.join(__dirname, './css/preflight.css'), 'utf8'));
|
|
216
216
|
addBase([
|
|
@@ -911,7 +911,9 @@ let corePlugins1 = {
|
|
|
911
911
|
],
|
|
912
912
|
],
|
|
913
913
|
],
|
|
914
|
-
]
|
|
914
|
+
], {
|
|
915
|
+
supportsNegativeValues: true
|
|
916
|
+
}),
|
|
915
917
|
transform: ({ addBase , addUtilities })=>{
|
|
916
918
|
addBase({
|
|
917
919
|
'@defaults transform': {
|
|
@@ -1679,10 +1681,10 @@ let corePlugins1 = {
|
|
|
1679
1681
|
}
|
|
1680
1682
|
});
|
|
1681
1683
|
},
|
|
1682
|
-
divideColor: ({ matchUtilities , theme , corePlugins })=>{
|
|
1684
|
+
divideColor: ({ matchUtilities , theme , corePlugins: corePlugins1 })=>{
|
|
1683
1685
|
matchUtilities({
|
|
1684
1686
|
divide: (value)=>{
|
|
1685
|
-
if (!
|
|
1687
|
+
if (!corePlugins1('divideOpacity')) {
|
|
1686
1688
|
return {
|
|
1687
1689
|
['& > :not([hidden]) ~ :not([hidden])']: {
|
|
1688
1690
|
'border-color': (0, _toColorValue).default(value)
|
|
@@ -2093,8 +2095,8 @@ let corePlugins1 = {
|
|
|
2093
2095
|
}
|
|
2094
2096
|
});
|
|
2095
2097
|
},
|
|
2096
|
-
borderColor: ({ addBase , matchUtilities , theme , corePlugins })=>{
|
|
2097
|
-
if (!
|
|
2098
|
+
borderColor: ({ addBase , matchUtilities , theme , corePlugins: corePlugins2 })=>{
|
|
2099
|
+
if (!corePlugins2('borderOpacity')) {
|
|
2098
2100
|
let value = theme('borderColor.DEFAULT', 'currentColor');
|
|
2099
2101
|
addBase({
|
|
2100
2102
|
'@defaults border-width': {
|
|
@@ -2112,7 +2114,7 @@ let corePlugins1 = {
|
|
|
2112
2114
|
}
|
|
2113
2115
|
matchUtilities({
|
|
2114
2116
|
border: (value)=>{
|
|
2115
|
-
if (!
|
|
2117
|
+
if (!corePlugins2('borderOpacity')) {
|
|
2116
2118
|
return {
|
|
2117
2119
|
'border-color': (0, _toColorValue).default(value)
|
|
2118
2120
|
};
|
|
@@ -2132,7 +2134,7 @@ let corePlugins1 = {
|
|
|
2132
2134
|
});
|
|
2133
2135
|
matchUtilities({
|
|
2134
2136
|
'border-x': (value)=>{
|
|
2135
|
-
if (!
|
|
2137
|
+
if (!corePlugins2('borderOpacity')) {
|
|
2136
2138
|
return {
|
|
2137
2139
|
'border-left-color': (0, _toColorValue).default(value),
|
|
2138
2140
|
'border-right-color': (0, _toColorValue).default(value)
|
|
@@ -2148,7 +2150,7 @@ let corePlugins1 = {
|
|
|
2148
2150
|
});
|
|
2149
2151
|
},
|
|
2150
2152
|
'border-y': (value)=>{
|
|
2151
|
-
if (!
|
|
2153
|
+
if (!corePlugins2('borderOpacity')) {
|
|
2152
2154
|
return {
|
|
2153
2155
|
'border-top-color': (0, _toColorValue).default(value),
|
|
2154
2156
|
'border-bottom-color': (0, _toColorValue).default(value)
|
|
@@ -2170,7 +2172,7 @@ let corePlugins1 = {
|
|
|
2170
2172
|
});
|
|
2171
2173
|
matchUtilities({
|
|
2172
2174
|
'border-t': (value)=>{
|
|
2173
|
-
if (!
|
|
2175
|
+
if (!corePlugins2('borderOpacity')) {
|
|
2174
2176
|
return {
|
|
2175
2177
|
'border-top-color': (0, _toColorValue).default(value)
|
|
2176
2178
|
};
|
|
@@ -2182,7 +2184,7 @@ let corePlugins1 = {
|
|
|
2182
2184
|
});
|
|
2183
2185
|
},
|
|
2184
2186
|
'border-r': (value)=>{
|
|
2185
|
-
if (!
|
|
2187
|
+
if (!corePlugins2('borderOpacity')) {
|
|
2186
2188
|
return {
|
|
2187
2189
|
'border-right-color': (0, _toColorValue).default(value)
|
|
2188
2190
|
};
|
|
@@ -2194,7 +2196,7 @@ let corePlugins1 = {
|
|
|
2194
2196
|
});
|
|
2195
2197
|
},
|
|
2196
2198
|
'border-b': (value)=>{
|
|
2197
|
-
if (!
|
|
2199
|
+
if (!corePlugins2('borderOpacity')) {
|
|
2198
2200
|
return {
|
|
2199
2201
|
'border-bottom-color': (0, _toColorValue).default(value)
|
|
2200
2202
|
};
|
|
@@ -2206,7 +2208,7 @@ let corePlugins1 = {
|
|
|
2206
2208
|
});
|
|
2207
2209
|
},
|
|
2208
2210
|
'border-l': (value)=>{
|
|
2209
|
-
if (!
|
|
2211
|
+
if (!corePlugins2('borderOpacity')) {
|
|
2210
2212
|
return {
|
|
2211
2213
|
'border-left-color': (0, _toColorValue).default(value)
|
|
2212
2214
|
};
|
|
@@ -2231,10 +2233,10 @@ let corePlugins1 = {
|
|
|
2231
2233
|
]
|
|
2232
2234
|
],
|
|
2233
2235
|
]),
|
|
2234
|
-
backgroundColor: ({ matchUtilities , theme , corePlugins })=>{
|
|
2236
|
+
backgroundColor: ({ matchUtilities , theme , corePlugins: corePlugins3 })=>{
|
|
2235
2237
|
matchUtilities({
|
|
2236
2238
|
bg: (value)=>{
|
|
2237
|
-
if (!
|
|
2239
|
+
if (!corePlugins3('backgroundOpacity')) {
|
|
2238
2240
|
return {
|
|
2239
2241
|
'background-color': (0, _toColorValue).default(value)
|
|
2240
2242
|
};
|
|
@@ -2760,10 +2762,10 @@ let corePlugins1 = {
|
|
|
2760
2762
|
], {
|
|
2761
2763
|
supportsNegativeValues: true
|
|
2762
2764
|
}),
|
|
2763
|
-
textColor: ({ matchUtilities , theme , corePlugins })=>{
|
|
2765
|
+
textColor: ({ matchUtilities , theme , corePlugins: corePlugins4 })=>{
|
|
2764
2766
|
matchUtilities({
|
|
2765
2767
|
text: (value)=>{
|
|
2766
|
-
if (!
|
|
2768
|
+
if (!corePlugins4('textOpacity')) {
|
|
2767
2769
|
return {
|
|
2768
2770
|
color: (0, _toColorValue).default(value)
|
|
2769
2771
|
};
|
|
@@ -2874,10 +2876,10 @@ let corePlugins1 = {
|
|
|
2874
2876
|
}
|
|
2875
2877
|
});
|
|
2876
2878
|
},
|
|
2877
|
-
placeholderColor: ({ matchUtilities , theme , corePlugins })=>{
|
|
2879
|
+
placeholderColor: ({ matchUtilities , theme , corePlugins: corePlugins5 })=>{
|
|
2878
2880
|
matchUtilities({
|
|
2879
2881
|
placeholder: (value)=>{
|
|
2880
|
-
if (!
|
|
2882
|
+
if (!corePlugins5('placeholderOpacity')) {
|
|
2881
2883
|
return {
|
|
2882
2884
|
'&::placeholder': {
|
|
2883
2885
|
color: (0, _toColorValue).default(value)
|
|
@@ -3660,4 +3662,4 @@ let corePlugins1 = {
|
|
|
3660
3662
|
],
|
|
3661
3663
|
])
|
|
3662
3664
|
};
|
|
3663
|
-
exports.corePlugins =
|
|
3665
|
+
exports.corePlugins = corePlugins;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.default = expandApplyAtRules;
|
|
6
6
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
7
|
+
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
|
7
8
|
var _generateRules = require("./generateRules");
|
|
8
9
|
var _bigSign = _interopRequireDefault(require("../util/bigSign"));
|
|
9
10
|
var _escapeClassName = _interopRequireDefault(require("../util/escapeClassName"));
|
|
@@ -12,9 +13,21 @@ function _interopRequireDefault(obj) {
|
|
|
12
13
|
default: obj
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
function containsBase(selector, classCandidateBase, separator) {
|
|
17
|
+
return (0, _postcssSelectorParser).default((selectors)=>{
|
|
18
|
+
let contains = false;
|
|
19
|
+
selectors.walkClasses((classSelector)=>{
|
|
20
|
+
if (classSelector.value.split(separator).pop() === classCandidateBase) {
|
|
21
|
+
contains = true;
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return contains;
|
|
26
|
+
}).transformSync(selector);
|
|
27
|
+
}
|
|
28
|
+
function prefix(context, selector) {
|
|
29
|
+
let prefix1 = context.tailwindConfig.prefix;
|
|
30
|
+
return typeof prefix1 === 'function' ? prefix1(selector) : prefix1 + selector;
|
|
18
31
|
}
|
|
19
32
|
function buildApplyCache(applyCandidates, context) {
|
|
20
33
|
for (let candidate of applyCandidates){
|
|
@@ -127,8 +140,8 @@ function processApply(root, context) {
|
|
|
127
140
|
*/ // TODO: Should we use postcss-selector-parser for this instead?
|
|
128
141
|
function replaceSelector(selector, utilitySelectors, candidate) {
|
|
129
142
|
let needle = `.${(0, _escapeClassName).default(candidate)}`;
|
|
130
|
-
let utilitySelectorsList = utilitySelectors.split(/\s
|
|
131
|
-
return selector.split(/\s
|
|
143
|
+
let utilitySelectorsList = utilitySelectors.split(/\s*\,(?![^(]*\))\s*/g);
|
|
144
|
+
return selector.split(/\s*\,(?![^(]*\))\s*/g).map((s)=>{
|
|
132
145
|
let replaced = [];
|
|
133
146
|
for (let utilitySelector of utilitySelectorsList){
|
|
134
147
|
let replacedSelector = utilitySelector.replace(needle, s);
|
|
@@ -156,7 +169,7 @@ function processApply(root, context) {
|
|
|
156
169
|
}
|
|
157
170
|
for (let applyCandidate of applyCandidates){
|
|
158
171
|
if (!applyClassCache.has(applyCandidate)) {
|
|
159
|
-
if (applyCandidate ===
|
|
172
|
+
if (applyCandidate === prefix(context, 'group')) {
|
|
160
173
|
// TODO: Link to specific documentation page with error code.
|
|
161
174
|
throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`);
|
|
162
175
|
}
|
|
@@ -173,7 +186,11 @@ function processApply(root, context) {
|
|
|
173
186
|
for (const [parent, candidates] of perParentApplies){
|
|
174
187
|
let siblings = [];
|
|
175
188
|
for (let [applyCandidate, important, rules] of candidates){
|
|
189
|
+
let base = applyCandidate.split(context.tailwindConfig.separator).pop();
|
|
176
190
|
for (let [meta, node] of rules){
|
|
191
|
+
if (containsBase(parent.selector, base, context.tailwindConfig.separator) && containsBase(node.selector, base, context.tailwindConfig.separator)) {
|
|
192
|
+
throw node.error(`Circular dependency detected when using: \`@apply ${applyCandidate}\``);
|
|
193
|
+
}
|
|
177
194
|
let root = _postcss.default.root({
|
|
178
195
|
nodes: [
|
|
179
196
|
node.clone()
|
|
@@ -79,7 +79,7 @@ function extractElementSelector(selector) {
|
|
|
79
79
|
function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
80
80
|
return (root)=>{
|
|
81
81
|
let variableNodeMap = new Map();
|
|
82
|
-
let universals = new Set();
|
|
82
|
+
/** @type {Set<import('postcss').AtRule>} */ let universals = new Set();
|
|
83
83
|
root.walkAtRules('defaults', (rule)=>{
|
|
84
84
|
if (rule.nodes && rule.nodes.length > 0) {
|
|
85
85
|
universals.add(rule);
|
|
@@ -93,32 +93,46 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
93
93
|
rule.remove();
|
|
94
94
|
});
|
|
95
95
|
for (let universal of universals){
|
|
96
|
-
let
|
|
96
|
+
/** @type {Map<string, Set<string>>} */ let selectorGroups = new Map();
|
|
97
97
|
var ref;
|
|
98
98
|
let rules = (ref = variableNodeMap.get(universal.params)) !== null && ref !== void 0 ? ref : [];
|
|
99
99
|
for (let rule of rules){
|
|
100
100
|
for (let selector of extractElementSelector(rule.selector)){
|
|
101
|
+
// If selector contains a vendor prefix after a pseudo element or class,
|
|
102
|
+
// we consider them separately because merging the declarations into
|
|
103
|
+
// a single rule will cause browsers that do not understand the
|
|
104
|
+
// vendor prefix to throw out the whole rule
|
|
105
|
+
let selectorGroupName = selector.includes(':-') || selector.includes('::-') ? selector : '__DEFAULT__';
|
|
106
|
+
var ref1;
|
|
107
|
+
let selectors = (ref1 = selectorGroups.get(selectorGroupName)) !== null && ref1 !== void 0 ? ref1 : new Set();
|
|
108
|
+
selectorGroups.set(selectorGroupName, selectors);
|
|
101
109
|
selectors.add(selector);
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
|
-
if (
|
|
112
|
+
if (selectorGroups.size === 0) {
|
|
105
113
|
universal.remove();
|
|
106
114
|
continue;
|
|
107
115
|
}
|
|
108
|
-
let universalRule = _postcss.default.rule();
|
|
109
116
|
if ((0, _featureFlags).flagEnabled(tailwindConfig, 'optimizeUniversalDefaults')) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
for (let [, selectors] of selectorGroups){
|
|
118
|
+
let universalRule = _postcss.default.rule();
|
|
119
|
+
universalRule.selectors = [
|
|
120
|
+
...selectors
|
|
121
|
+
];
|
|
122
|
+
universalRule.append(universal.nodes.map((node)=>node.clone()
|
|
123
|
+
));
|
|
124
|
+
universal.before(universalRule);
|
|
125
|
+
}
|
|
113
126
|
} else {
|
|
127
|
+
let universalRule = _postcss.default.rule();
|
|
114
128
|
universalRule.selectors = [
|
|
115
129
|
'*',
|
|
116
130
|
'::before',
|
|
117
131
|
'::after'
|
|
118
132
|
];
|
|
133
|
+
universalRule.append(universal.nodes);
|
|
134
|
+
universal.before(universalRule);
|
|
119
135
|
}
|
|
120
|
-
universalRule.append(universal.nodes);
|
|
121
|
-
universal.before(universalRule);
|
|
122
136
|
universal.remove();
|
|
123
137
|
}
|
|
124
138
|
};
|