tailwindcss 0.0.0-insiders.cd5cb00 → 0.0.0-insiders.d50b049

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 CHANGED
@@ -7,6 +7,10 @@ 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.0-alpha.1] - 2021-10-01
13
+
10
14
  ### Changed
11
15
 
12
16
  - Remove AOT engine, make JIT the default ([#5340](https://github.com/tailwindlabs/tailwindcss/pull/5340))
@@ -21,14 +25,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
25
  - Add native `aspect-ratio` utilities ([#5359](https://github.com/tailwindlabs/tailwindcss/pull/5359))
22
26
  - Unify config callback helpers into single object ([#5382](https://github.com/tailwindlabs/tailwindcss/pull/5382))
23
27
  - Preserve original color format when adding opacity whenever possible ([#5154](https://github.com/tailwindlabs/tailwindcss/pull/5154))
28
+ - Add `accent-color` utilities ([#5387](https://github.com/tailwindlabs/tailwindcss/pull/5387))
24
29
  - Add `scroll-behavior` utilities ([#5388](https://github.com/tailwindlabs/tailwindcss/pull/5388))
30
+ - Add `will-change` utilities ([#5448](https://github.com/tailwindlabs/tailwindcss/pull/5448))
31
+ - Add `column` utilities ([#5457](https://github.com/tailwindlabs/tailwindcss/pull/5457))
25
32
  - Add `border-hidden` utility ([#5485](https://github.com/tailwindlabs/tailwindcss/pull/5485))
26
33
  - Add `align-sub` and `align-super` utilities by default ([#5486](https://github.com/tailwindlabs/tailwindcss/pull/5486))
27
34
  - Add `break-before`, `break-inside` and `break-after` utilities ([#5530](https://github.com/tailwindlabs/tailwindcss/pull/5530))
28
35
  - Add `file` variant for `::file-selector-button` pseudo element ([#4936](https://github.com/tailwindlabs/tailwindcss/pull/4936))
36
+ - Add comprehensive arbitrary value support ([#5568](https://github.com/tailwindlabs/tailwindcss/pull/5568))
29
37
  - Add `touch-action` utilities ([#5603](https://github.com/tailwindlabs/tailwindcss/pull/5603))
30
38
  - Add `inherit` to default color palette ([#5597](https://github.com/tailwindlabs/tailwindcss/pull/5597))
31
39
  - Add `overflow-clip`, `overflow-x-clip` and `overflow-y-clip` utilities ([#5630](https://github.com/tailwindlabs/tailwindcss/pull/5630))
40
+ - Add `[open]` variant ([#5627](https://github.com/tailwindlabs/tailwindcss/pull/5627))
32
41
  - Add `scroll-snap` utilities ([#5637](https://github.com/tailwindlabs/tailwindcss/pull/5637))
33
42
  - Add `border-x` and `border-y` width and color utilities ([#5639](https://github.com/tailwindlabs/tailwindcss/pull/5639))
34
43
 
@@ -1596,7 +1605,8 @@ No release notes
1596
1605
 
1597
1606
  - Everything!
1598
1607
 
1599
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.16...HEAD
1608
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.1...HEAD
1609
+ [3.0.0-alpha.1]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.16...v3.0.0-alpha.1
1600
1610
  [2.2.16]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.15...v2.2.16
1601
1611
  [2.2.15]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.14...v2.2.15
1602
1612
  [2.2.14]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.13...v2.2.14
package/lib/cli.js CHANGED
@@ -400,11 +400,8 @@ async function build() {
400
400
  }
401
401
  return resolvedConfig;
402
402
  }
403
- function extractContent(config) {
404
- return config.content.content.concat(config.content.safelist);
405
- }
406
403
  function extractFileGlobs(config) {
407
- return extractContent(config).filter((file)=>{
404
+ return config.content.files.filter((file)=>{
408
405
  // Strings in this case are files / globs. If it is something else,
409
406
  // like an object it's probably a raw content object. But this object
410
407
  // is not watchable, so let's remove it.
@@ -413,7 +410,7 @@ async function build() {
413
410
  );
414
411
  }
415
412
  function extractRawContent(config) {
416
- return extractContent(config).filter((file)=>{
413
+ return config.content.files.filter((file)=>{
417
414
  return typeof file === 'object' && file !== null;
418
415
  });
419
416
  }
@@ -425,7 +422,7 @@ async function build() {
425
422
  for (let file of files){
426
423
  changedContent.push({
427
424
  content: _fs.default.readFileSync(_path.default.resolve(file), 'utf8'),
428
- extension: _path.default.extname(file)
425
+ extension: _path.default.extname(file).slice(1)
429
426
  });
430
427
  }
431
428
  // Resolve raw content in the tailwind config
@@ -674,7 +671,7 @@ async function build() {
674
671
  chain = chain.then(async ()=>{
675
672
  changedContent.push({
676
673
  content: _fs.default.readFileSync(_path.default.resolve(file), 'utf8'),
677
- extension: _path.default.extname(file)
674
+ extension: _path.default.extname(file).slice(1)
678
675
  });
679
676
  await rebuild(config);
680
677
  });
@@ -684,7 +681,7 @@ async function build() {
684
681
  chain = chain.then(async ()=>{
685
682
  changedContent.push({
686
683
  content: _fs.default.readFileSync(_path.default.resolve(file), 'utf8'),
687
- extension: _path.default.extname(file)
684
+ extension: _path.default.extname(file).slice(1)
688
685
  });
689
686
  await rebuild(config);
690
687
  });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = void 0;
5
+ exports.variantPlugins = exports.corePlugins = void 0;
6
6
  var _fs = _interopRequireDefault(require("fs"));
7
7
  var _postcss = _interopRequireDefault(require("postcss"));
8
8
  var _createUtilityPlugin = _interopRequireDefault(require("./util/createUtilityPlugin"));
@@ -45,8 +45,7 @@ function _interopRequireWildcard(obj) {
45
45
  return newObj;
46
46
  }
47
47
  }
48
- var _default = {
49
- // Variant plugins
48
+ let variantPlugins = {
50
49
  pseudoElementVariants: ({ config , addVariant })=>{
51
50
  addVariant('first-letter', (0, _pluginUtils).transformAllSelectors((selector)=>{
52
51
  return (0, _pluginUtils).updateAllClasses(selector, (className, { withPseudo })=>{
@@ -234,12 +233,22 @@ var _default = {
234
233
  }
235
234
  },
236
235
  directionVariants: ({ config , addVariant })=>{
237
- addVariant('ltr', (0, _pluginUtils).transformAllSelectors((selector)=>`[dir="ltr"] ${(0, _pluginUtils).updateAllClasses(selector, (className)=>`ltr${config('separator')}${className}`
238
- )}`
239
- ));
240
- addVariant('rtl', (0, _pluginUtils).transformAllSelectors((selector)=>`[dir="rtl"] ${(0, _pluginUtils).updateAllClasses(selector, (className)=>`rtl${config('separator')}${className}`
241
- )}`
242
- ));
236
+ addVariant('ltr', (0, _pluginUtils).transformAllSelectors((selector)=>{
237
+ _log.default.warn('rtl-experimental', [
238
+ 'The RTL features in Tailwind CSS are currently in preview.',
239
+ 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
240
+ ]);
241
+ return `[dir="ltr"] ${(0, _pluginUtils).updateAllClasses(selector, (className)=>`ltr${config('separator')}${className}`
242
+ )}`;
243
+ }));
244
+ addVariant('rtl', (0, _pluginUtils).transformAllSelectors((selector)=>{
245
+ _log.default.warn('rtl-experimental', [
246
+ 'The RTL features in Tailwind CSS are currently in preview.',
247
+ 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
248
+ ]);
249
+ return `[dir="rtl"] ${(0, _pluginUtils).updateAllClasses(selector, (className)=>`rtl${config('separator')}${className}`
250
+ )}`;
251
+ }));
243
252
  },
244
253
  reducedMotionVariants: ({ config , addVariant })=>{
245
254
  addVariant('motion-safe', (0, _pluginUtils).transformLastClasses((className)=>{
@@ -264,8 +273,8 @@ var _default = {
264
273
  if (mode === false) {
265
274
  mode = 'media';
266
275
  _log.default.warn('darkmode-false', [
267
- '`darkMode` is set to `false` in your config.',
268
- 'This will behave just like the `media` value.',
276
+ 'The `darkMode` option in your Tailwind CSS configuration is set to `false`, which now behaves the same as `media`.',
277
+ 'Change `darkMode` to `media` or remove it entirely.',
269
278
  ]);
270
279
  }
271
280
  if (mode === 'class') {
@@ -303,8 +312,10 @@ var _default = {
303
312
  })
304
313
  }));
305
314
  }
306
- },
307
- // Actual plugins
315
+ }
316
+ };
317
+ exports.variantPlugins = variantPlugins;
318
+ let corePlugins = {
308
319
  preflight: ({ addBase })=>{
309
320
  let preflightStyles = _postcss.default.parse(_fs.default.readFileSync(`${__dirname}/css/preflight.css`, 'utf8'));
310
321
  addBase([
@@ -1049,31 +1060,26 @@ var _default = {
1049
1060
  }).map(([key, value])=>{
1050
1061
  return [
1051
1062
  key,
1052
- [
1053
- {
1054
- [`@keyframes ${prefixName(key)}`]: value
1055
- }
1056
- ]
1063
+ {
1064
+ [`@keyframes ${prefixName(key)}`]: value
1065
+ }
1057
1066
  ];
1058
1067
  }));
1059
1068
  matchUtilities({
1060
- animate: (value, { includeRules })=>{
1069
+ animate: (value)=>{
1061
1070
  let animations = (0, _parseAnimationValue).default(value);
1062
- for (let { name } of animations){
1063
- if (keyframes[name] !== undefined) {
1064
- includeRules(keyframes[name], {
1065
- respectImportant: false
1066
- });
1067
- }
1068
- }
1069
- return {
1070
- animation: animations.map(({ name , value })=>{
1071
- if (name === undefined || keyframes[name] === undefined) {
1072
- return value;
1073
- }
1074
- return value.replace(name, prefixName(name));
1075
- }).join(', ')
1076
- };
1071
+ return [
1072
+ ...animations.flatMap((animation)=>keyframes[animation.name]
1073
+ ),
1074
+ {
1075
+ animation: animations.map(({ name , value })=>{
1076
+ if (name === undefined || keyframes[name] === undefined) {
1077
+ return value;
1078
+ }
1079
+ return value.replace(name, prefixName(name));
1080
+ }).join(', ')
1081
+ },
1082
+ ];
1077
1083
  }
1078
1084
  }, {
1079
1085
  values: theme('animation')
@@ -3522,4 +3528,4 @@ var _default = {
3522
3528
  ]),
3523
3529
  content: (0, _createUtilityPlugin).default('content')
3524
3530
  };
3525
- exports.default = _default;
3531
+ exports.corePlugins = corePlugins;
@@ -49,7 +49,7 @@ function issueFlagNotices(config) {
49
49
  ).join(', ');
50
50
  _log.default.warn('experimental-flags-enabled', [
51
51
  `You have enabled experimental features: ${changes}`,
52
- 'Experimental features are not covered by semver, may introduce breaking changes, and can change at any time.',
52
+ 'Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time.',
53
53
  ]);
54
54
  }
55
55
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.default = expandTailwindAtRules;
6
+ var _quickLru = _interopRequireDefault(require("quick-lru"));
6
7
  var sharedState = _interopRequireWildcard(require("./sharedState"));
7
8
  var _generateRules = require("./generateRules");
8
9
  var _bigSign = _interopRequireDefault(require("../util/bigSign"));
@@ -36,7 +37,6 @@ function _interopRequireWildcard(obj) {
36
37
  }
37
38
  }
38
39
  let env = sharedState.env;
39
- let contentMatchCache = sharedState.contentMatchCache;
40
40
  const PATTERNS = [
41
41
  /([^<>"'`\s]*\[\w*'[^"`\s]*'?\])/.source,
42
42
  /([^<>"'`\s]*\[\w*"[^"`\s]*"?\])/.source,
@@ -66,43 +66,30 @@ const builtInTransformers = {
66
66
  };
67
67
  function getExtractor(tailwindConfig, fileExtension) {
68
68
  let extractors = tailwindConfig.content.extract;
69
- let contentOptions = tailwindConfig.content.options;
70
- if (typeof extractors === 'function') {
71
- extractors = {
72
- DEFAULT: extractors
73
- };
74
- }
75
- if (contentOptions.defaultExtractor) {
76
- extractors.DEFAULT = contentOptions.defaultExtractor;
77
- }
78
- for (let { extensions , extractor } of contentOptions.extractors || []){
79
- for (let extension of extensions){
80
- extractors[extension] = extractor;
81
- }
82
- }
83
69
  return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || builtInExtractors.DEFAULT;
84
70
  }
85
71
  function getTransformer(tailwindConfig, fileExtension) {
86
72
  let transformers = tailwindConfig.content.transform;
87
- if (typeof transformers === 'function') {
88
- transformers = {
89
- DEFAULT: transformers
90
- };
91
- }
92
73
  return transformers[fileExtension] || transformers.DEFAULT || builtInTransformers[fileExtension] || builtInTransformers.DEFAULT;
93
74
  }
75
+ let extractorCache = new WeakMap();
94
76
  // Scans template contents for possible classes. This is a hot path on initial build but
95
77
  // not too important for subsequent builds. The faster the better though — if we can speed
96
78
  // up these regexes by 50% that could cut initial build time by like 20%.
97
- function getClassCandidates(content, extractor, contentMatchCache, candidates, seen) {
79
+ function getClassCandidates(content, extractor, candidates, seen) {
80
+ if (!extractorCache.has(extractor)) {
81
+ extractorCache.set(extractor, new _quickLru.default({
82
+ maxSize: 25000
83
+ }));
84
+ }
98
85
  for (let line of content.split('\n')){
99
86
  line = line.trim();
100
87
  if (seen.has(line)) {
101
88
  continue;
102
89
  }
103
90
  seen.add(line);
104
- if (contentMatchCache.has(line)) {
105
- for (let match of contentMatchCache.get(line)){
91
+ if (extractorCache.get(extractor).has(line)) {
92
+ for (let match of extractorCache.get(extractor).get(line)){
106
93
  candidates.add(match);
107
94
  }
108
95
  } else {
@@ -112,7 +99,7 @@ function getClassCandidates(content, extractor, contentMatchCache, candidates, s
112
99
  for (let match of lineMatchesSet){
113
100
  candidates.add(match);
114
101
  }
115
- contentMatchCache.set(line, lineMatchesSet);
102
+ extractorCache.get(extractor).set(line, lineMatchesSet);
116
103
  }
117
104
  }
118
105
  }
@@ -189,7 +176,7 @@ function expandTailwindAtRules(context) {
189
176
  for (let { content , extension } of context.changedContent){
190
177
  let transformer = getTransformer(context.tailwindConfig, extension);
191
178
  let extractor = getExtractor(context.tailwindConfig, extension);
192
- getClassCandidates(transformer(content), extractor, contentMatchCache, candidates, seen);
179
+ getClassCandidates(transformer(content), extractor, candidates, seen);
193
180
  }
194
181
  // ---
195
182
  // Generate the actual CSS
@@ -120,13 +120,6 @@ function applyVariant(variant, matches, context) {
120
120
  let variantFunctionTuples = context.variantMap.get(variant);
121
121
  let result = [];
122
122
  for (let [meta, rule] of matches){
123
- if (meta.options.respectVariants === false) {
124
- result.push([
125
- meta,
126
- rule
127
- ]);
128
- continue;
129
- }
130
123
  let container = _postcss.default.root({
131
124
  nodes: [
132
125
  rule.clone()
@@ -322,16 +315,14 @@ function* resolveMatches(candidate, context) {
322
315
  ) // Re-indent
323
316
  .join('\n')
324
317
  ).join('\n\n');
325
- messages.push(` - Replace "${candidate}" with "${candidate.replace('[', `[${type}:`)}" for:\n${rules}\n`);
318
+ messages.push(` Use \`${candidate.replace('[', `[${type}:`)}\` for \`${rules.trim()}\``);
326
319
  break;
327
320
  }
328
321
  }
329
322
  _log.default.warn([
330
- // TODO: Update URL
331
- `The class "${candidate}" is ambiguous and matches multiple utilities. Use a type hint (https://tailwindcss.com/docs/just-in-time-mode#ambiguous-values) to fix this.`,
332
- '',
323
+ `The class \`${candidate}\` is ambiguous and matches multiple utilities.`,
333
324
  ...messages,
334
- `If this is just part of your content and not a class, replace it with "${candidate.replace('[', '&lsqb;').replace(']', '&rsqb;')}" to silence this warning.`,
325
+ `If this is content and not a class, replace it with \`${candidate.replace('[', '&lsqb;').replace(']', '&rsqb;')}\` to silence this warning.`,
335
326
  ]);
336
327
  continue;
337
328
  }
@@ -44,7 +44,8 @@ function normalizeTailwindDirectives(root) {
44
44
  'variants'
45
45
  ].includes(atRule.name)) {
46
46
  _log.default.warn(`${atRule.name}-at-rule-deprecated`, [
47
- `'@${atRule.name}' is deprecated, use '@layer utilities' or '@layer components' instead.`,
47
+ `The \`@${atRule.name}\` directive has been deprecated in Tailwind CSS v3.0.`,
48
+ `Use \`@layer utilities\` or \`@layer components\` instead.`,
48
49
  ]);
49
50
  }
50
51
  layerDirectives.add(atRule);