tailwindcss 3.0.0-alpha.2 → 3.0.0

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.
Files changed (42) hide show
  1. package/lib/cli.js +58 -58
  2. package/lib/corePluginList.js +3 -0
  3. package/lib/corePlugins.js +138 -65
  4. package/lib/css/preflight.css +2 -1
  5. package/lib/lib/detectNesting.js +17 -2
  6. package/lib/lib/evaluateTailwindFunctions.js +6 -2
  7. package/lib/lib/expandApplyAtRules.js +4 -4
  8. package/lib/lib/expandTailwindAtRules.js +2 -0
  9. package/lib/lib/generateRules.js +36 -0
  10. package/lib/lib/setupContextUtils.js +8 -65
  11. package/lib/lib/substituteScreenAtRules.js +7 -4
  12. package/lib/util/buildMediaQuery.js +13 -24
  13. package/lib/util/dataTypes.js +14 -3
  14. package/lib/util/formatVariantSelector.js +88 -4
  15. package/lib/util/isValidArbitraryValue.js +64 -0
  16. package/lib/util/nameClass.js +1 -0
  17. package/lib/util/normalizeScreens.js +61 -0
  18. package/lib/util/resolveConfig.js +8 -8
  19. package/package.json +10 -10
  20. package/peers/.svgo.yml +75 -0
  21. package/peers/index.js +3784 -3146
  22. package/peers/orders/concentric-css.json +299 -0
  23. package/peers/orders/smacss.json +299 -0
  24. package/peers/orders/source.json +295 -0
  25. package/src/.DS_Store +0 -0
  26. package/src/corePluginList.js +1 -1
  27. package/src/corePlugins.js +114 -60
  28. package/src/css/preflight.css +2 -1
  29. package/src/lib/detectNesting.js +22 -3
  30. package/src/lib/evaluateTailwindFunctions.js +5 -2
  31. package/src/lib/expandTailwindAtRules.js +2 -0
  32. package/src/lib/generateRules.js +34 -0
  33. package/src/lib/setupContextUtils.js +6 -58
  34. package/src/lib/substituteScreenAtRules.js +6 -3
  35. package/src/util/buildMediaQuery.js +14 -18
  36. package/src/util/dataTypes.js +11 -6
  37. package/src/util/formatVariantSelector.js +92 -1
  38. package/src/util/isValidArbitraryValue.js +61 -0
  39. package/src/util/nameClass.js +1 -1
  40. package/src/util/normalizeScreens.js +45 -0
  41. package/stubs/defaultConfig.stub.js +17 -0
  42. package/CHANGELOG.md +0 -1825
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 (commands && commands.length > 0) {
64
+ if (commands1 && commands1.length > 0) {
65
65
  console.log();
66
66
  console.log('Commands:');
67
- for (let command of commands){
68
- console.log(' '.repeat(indent), command);
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 (flags.length === 1) {
92
- console.log(' '.repeat(indent + 4 /* 4 = "-i, ".length */ ), flags.slice().reverse().join(', ').padEnd(20, ' '), description);
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), flags.slice().reverse().join(', ').padEnd(24, ' '), description);
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 commands1 = {
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(commands1).filter((command)=>command !== 'build'
191
- ).map((command)=>`${command} [options]`
190
+ commands: Object.keys(commands).filter((command2)=>command2 !== 'build'
191
+ ).map((command3)=>`${command3} [options]`
192
192
  ),
193
193
  options: {
194
- ...commands1.build.args,
194
+ ...commands.build.args,
195
195
  ...sharedFlags
196
196
  }
197
197
  });
198
198
  process.exit(0);
199
199
  }
200
- let command1 = ((arg = '')=>arg.startsWith('-') ? undefined : arg
200
+ let command = ((arg = '')=>arg.startsWith('-') ? undefined : arg
201
201
  )(process.argv[2]) || 'build';
202
- if (commands1[command1] === undefined) {
203
- if (_fs.default.existsSync(_path.default.resolve(command1))) {
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
- command1 = 'build';
206
+ command = 'build';
207
207
  } else {
208
208
  help({
209
- message: `Invalid command: ${command1}`,
209
+ message: `Invalid command: ${command}`,
210
210
  usage: [
211
211
  'tailwindcss <command> [options]'
212
212
  ],
213
- commands: Object.keys(commands1).filter((command)=>command !== 'build'
214
- ).map((command)=>`${command} [options]`
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: flags1 , run } = commands1[command1];
223
- let args1 = (()=>{
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
- ...flags1,
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 = flags1[flag];
243
+ let handler = flags[flag];
244
244
  // Resolve flagName & handler
245
245
  while(typeof handler === 'string'){
246
246
  flagName = handler;
247
- handler = flags1[handler];
247
+ handler = flags[handler];
248
248
  }
249
249
  if (!handler) continue;
250
- let args = [];
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
- args.push(result['_'][offset++]);
254
+ args1.push(result['_'][offset++]);
255
255
  }
256
256
  // Cleanup manually parsed flags + args
257
- result['_'].splice(i, 1 + args.length);
257
+ result['_'].splice(i, 1 + args1.length);
258
258
  // Set the resolved value in the `result` object
259
- result[flagName] = handler.type(args.length === 0 ? undefined : args.length === 1 ? args[0] : args, flagName);
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] !== command1) {
268
- result['_'].unshift(command1);
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 (args1['--help']) {
285
+ if (args['--help']) {
286
286
  help({
287
287
  options: {
288
- ...flags1,
288
+ ...flags,
289
289
  ...sharedFlags
290
290
  },
291
291
  usage: [
292
- `tailwindcss ${command1} [options]`
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 = args1['_'][1]) !== null && ref !== void 0 ? ref : './tailwind.config.js');
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(args1['--full'] ? _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js') : _path.default.resolve(__dirname, '../stubs/simpleConfig.stub.js'), 'utf8');
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 (args1['--postcss']) {
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 = args1['--input'];
331
- let output = args1['--output'];
332
- let shouldWatch = args1['--watch'];
333
- let includePostCss = args1['--postcss'];
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 && args1['_'][1]) {
335
+ if (!input && args['_'][1]) {
336
336
  console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
337
- input = args1['--input'] = args1['_'][1];
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 ${args1['--input']} does not exist.`);
340
+ console.error(`Specified input file ${args['--input']} does not exist.`);
341
341
  process.exit(9);
342
342
  }
343
- if (args1['--config'] && !_fs.default.existsSync(args1['--config'] = _path.default.resolve(args1['--config']))) {
344
- console.error(`Specified config file ${args1['--config']} does not exist.`);
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 = args1['--config'] ? args1['--config'] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null
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 args1['--postcss'] === 'string' ? args1['--postcss'] : undefined;
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 (args1['--purge']) {
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 (!args1['--content']) {
395
- args1['--content'] = args1['--purge'];
394
+ if (!args['--content']) {
395
+ args['--content'] = args['--purge'];
396
396
  }
397
397
  }
398
- if (args1['--content']) {
399
- resolvedConfig.content.files = args1['--content'].split(/(?<!{[^}]+),/);
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
- !args1['--minify'] && formatNodes,
460
+ !args['--minify'] && formatNodes,
461
461
  ...afterPlugins,
462
- !args1['--no-autoprefixer'] && (()=>{
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
- args1['--minify'] && (()=>{
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
- !args1['--minify'] && formatNodes,
544
+ !args['--minify'] && formatNodes,
545
545
  ...afterPlugins,
546
- !args1['--no-autoprefixer'] && (()=>{
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
- args1['--minify'] && (()=>{
554
+ args['--minify'] && (()=>{
555
555
  let options = {
556
556
  preset: [
557
557
  'default',
@@ -126,6 +126,9 @@ var _default = [
126
126
  "textOpacity",
127
127
  "textDecoration",
128
128
  "textDecorationColor",
129
+ "textDecorationStyle",
130
+ "textDecorationThickness",
131
+ "textUnderlineOffset",
129
132
  "fontSmoothing",
130
133
  "placeholderColor",
131
134
  "placeholderOpacity",