tailwindcss 0.0.0-insiders.bd21bef → 0.0.0-insiders.be36eba

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/CHANGELOG.md +29 -1
  2. package/lib/cli.js +6 -2
  3. package/lib/corePluginList.js +2 -0
  4. package/lib/corePlugins.js +77 -18
  5. package/lib/css/preflight.css +7 -0
  6. package/lib/featureFlags.js +10 -7
  7. package/lib/lib/expandTailwindAtRules.js +0 -1
  8. package/lib/lib/generateRules.js +10 -6
  9. package/lib/lib/normalizeTailwindDirectives.js +2 -1
  10. package/lib/lib/resolveDefaultsAtRules.js +44 -47
  11. package/lib/lib/setupContextUtils.js +16 -19
  12. package/lib/lib/setupWatchingContext.js +5 -1
  13. package/lib/processTailwindFeatures.js +2 -0
  14. package/lib/public/colors.js +1 -1
  15. package/lib/util/createUtilityPlugin.js +3 -3
  16. package/lib/util/nameClass.js +1 -1
  17. package/lib/util/negateValue.js +3 -1
  18. package/lib/util/normalizeConfig.js +13 -10
  19. package/lib/util/pluginUtils.js +53 -25
  20. package/lib/util/resolveConfig.js +5 -1
  21. package/package.json +7 -7
  22. package/peers/index.js +607 -617
  23. package/src/cli.js +8 -1
  24. package/src/corePluginList.js +1 -1
  25. package/src/corePlugins.js +114 -62
  26. package/src/css/preflight.css +7 -0
  27. package/src/featureFlags.js +11 -5
  28. package/src/lib/expandTailwindAtRules.js +0 -1
  29. package/src/lib/generateRules.js +9 -12
  30. package/src/lib/normalizeTailwindDirectives.js +2 -1
  31. package/src/lib/resolveDefaultsAtRules.js +39 -43
  32. package/src/lib/setupContextUtils.js +18 -22
  33. package/src/lib/setupWatchingContext.js +7 -0
  34. package/src/processTailwindFeatures.js +3 -0
  35. package/src/public/colors.js +1 -1
  36. package/src/util/createUtilityPlugin.js +2 -2
  37. package/src/util/nameClass.js +1 -1
  38. package/src/util/negateValue.js +4 -2
  39. package/src/util/normalizeConfig.js +8 -3
  40. package/src/util/pluginUtils.js +47 -20
  41. package/src/util/resolveConfig.js +7 -1
  42. package/stubs/defaultConfig.stub.js +78 -44
package/CHANGELOG.md CHANGED
@@ -9,6 +9,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Changed
11
11
 
12
+ - Don't use pointer cursor on disabled buttons by default ([#5772](https://github.com/tailwindlabs/tailwindcss/pull/5772))
13
+
14
+ ### Added
15
+
16
+ - Add `flex-basis` utilities ([#5671](https://github.com/tailwindlabs/tailwindcss/pull/5671))
17
+ - Make negative values a first-class feature ([#5709](https://github.com/tailwindlabs/tailwindcss/pull/5709))
18
+ - Add `fit-content` values for `min/max-width/height` utilities ([#5638](https://github.com/tailwindlabs/tailwindcss/pull/5638))
19
+ - Add `min/max-content` values for `min/max-height` utilities ([#5729](https://github.com/tailwindlabs/tailwindcss/pull/5729))
20
+ - Add all standard `cursor-*` values by default ([#5734](https://github.com/tailwindlabs/tailwindcss/pull/5734))
21
+ - Add `grow-*` and `shrink-*` utilities, deprecate `flex-grow-*` and `flex-shrink-*` ([#5733](https://github.com/tailwindlabs/tailwindcss/pull/5733))
22
+ - Add `text-decoration-color` utilities ([#5760](https://github.com/tailwindlabs/tailwindcss/pull/5760))
23
+
24
+ ### Fixed
25
+
26
+ - Configure chokidar's `awaitWriteFinish` setting to avoid occasional stale builds on Windows ([#5774](https://github.com/tailwindlabs/tailwindcss/pull/5774))
27
+ - Fix CLI `--content` option ([#5775](https://github.com/tailwindlabs/tailwindcss/pull/5775))
28
+
29
+ ## [3.0.0-alpha.1] - 2021-10-01
30
+
31
+ ### Changed
32
+
12
33
  - Remove AOT engine, make JIT the default ([#5340](https://github.com/tailwindlabs/tailwindcss/pull/5340))
13
34
  - Throw when trying to `@apply` the `group` class ([#4666](https://github.com/tailwindlabs/tailwindcss/pull/4666))
14
35
  - Remove dependency on `modern-normalize`, inline and consolidate with Preflight ([#5358](https://github.com/tailwindlabs/tailwindcss/pull/5358))
@@ -21,14 +42,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
42
  - Add native `aspect-ratio` utilities ([#5359](https://github.com/tailwindlabs/tailwindcss/pull/5359))
22
43
  - Unify config callback helpers into single object ([#5382](https://github.com/tailwindlabs/tailwindcss/pull/5382))
23
44
  - Preserve original color format when adding opacity whenever possible ([#5154](https://github.com/tailwindlabs/tailwindcss/pull/5154))
45
+ - Add `accent-color` utilities ([#5387](https://github.com/tailwindlabs/tailwindcss/pull/5387))
24
46
  - Add `scroll-behavior` utilities ([#5388](https://github.com/tailwindlabs/tailwindcss/pull/5388))
47
+ - Add `will-change` utilities ([#5448](https://github.com/tailwindlabs/tailwindcss/pull/5448))
48
+ - Add `text-indent` utilities ([#5449](https://github.com/tailwindlabs/tailwindcss/pull/5449))
49
+ - Add `column` utilities ([#5457](https://github.com/tailwindlabs/tailwindcss/pull/5457))
25
50
  - Add `border-hidden` utility ([#5485](https://github.com/tailwindlabs/tailwindcss/pull/5485))
26
51
  - Add `align-sub` and `align-super` utilities by default ([#5486](https://github.com/tailwindlabs/tailwindcss/pull/5486))
27
52
  - Add `break-before`, `break-inside` and `break-after` utilities ([#5530](https://github.com/tailwindlabs/tailwindcss/pull/5530))
28
53
  - Add `file` variant for `::file-selector-button` pseudo element ([#4936](https://github.com/tailwindlabs/tailwindcss/pull/4936))
54
+ - Add comprehensive arbitrary value support ([#5568](https://github.com/tailwindlabs/tailwindcss/pull/5568))
29
55
  - Add `touch-action` utilities ([#5603](https://github.com/tailwindlabs/tailwindcss/pull/5603))
30
56
  - Add `inherit` to default color palette ([#5597](https://github.com/tailwindlabs/tailwindcss/pull/5597))
31
57
  - Add `overflow-clip`, `overflow-x-clip` and `overflow-y-clip` utilities ([#5630](https://github.com/tailwindlabs/tailwindcss/pull/5630))
58
+ - Add `[open]` variant ([#5627](https://github.com/tailwindlabs/tailwindcss/pull/5627))
32
59
  - Add `scroll-snap` utilities ([#5637](https://github.com/tailwindlabs/tailwindcss/pull/5637))
33
60
  - Add `border-x` and `border-y` width and color utilities ([#5639](https://github.com/tailwindlabs/tailwindcss/pull/5639))
34
61
 
@@ -1596,7 +1623,8 @@ No release notes
1596
1623
 
1597
1624
  - Everything!
1598
1625
 
1599
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.16...HEAD
1626
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.1...HEAD
1627
+ [3.0.0-alpha.1]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.16...v3.0.0-alpha.1
1600
1628
  [2.2.16]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.15...v2.2.16
1601
1629
  [2.2.15]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.14...v2.2.15
1602
1630
  [2.2.14]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.13...v2.2.14
package/lib/cli.js CHANGED
@@ -396,7 +396,7 @@ async function build() {
396
396
  }
397
397
  }
398
398
  if (args['--content']) {
399
- resolvedConfig.content = args['--content'].split(/(?<!{[^}]+),/);
399
+ resolvedConfig.content.files = args['--content'].split(/(?<!{[^}]+),/);
400
400
  }
401
401
  return resolvedConfig;
402
402
  }
@@ -649,7 +649,11 @@ async function build() {
649
649
  ...contextDependencies,
650
650
  ...extractFileGlobs(config)
651
651
  ], {
652
- ignoreInitial: true
652
+ ignoreInitial: true,
653
+ awaitWriteFinish: process.platform === 'win32' ? {
654
+ stabilityThreshold: 50,
655
+ pollInterval: 10
656
+ } : false
653
657
  });
654
658
  let chain = Promise.resolve();
655
659
  watcher.on('change', async (file)=>{
@@ -35,6 +35,7 @@ var _default = [
35
35
  "flex",
36
36
  "flexShrink",
37
37
  "flexGrow",
38
+ "flexBasis",
38
39
  "tableLayout",
39
40
  "borderCollapse",
40
41
  "transformOrigin",
@@ -124,6 +125,7 @@ var _default = [
124
125
  "textColor",
125
126
  "textOpacity",
126
127
  "textDecoration",
128
+ "textDecorationColor",
127
129
  "fontSmoothing",
128
130
  "placeholderColor",
129
131
  "placeholderOpacity",
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.variantPlugins = exports.corePlugins = void 0;
6
6
  var _fs = _interopRequireDefault(require("fs"));
7
+ var path = _interopRequireWildcard(require("path"));
7
8
  var _postcss = _interopRequireDefault(require("postcss"));
8
9
  var _createUtilityPlugin = _interopRequireDefault(require("./util/createUtilityPlugin"));
9
10
  var _buildMediaQuery = _interopRequireDefault(require("./util/buildMediaQuery"));
@@ -273,8 +274,8 @@ let variantPlugins = {
273
274
  if (mode === false) {
274
275
  mode = 'media';
275
276
  _log.default.warn('darkmode-false', [
276
- '`darkMode` is set to `false` in your config.',
277
- 'This will behave just like the `media` value.',
277
+ 'The `darkMode` option in your Tailwind CSS configuration is set to `false`, which now behaves the same as `media`.',
278
+ 'Change `darkMode` to `media` or remove it entirely.',
278
279
  ]);
279
280
  }
280
281
  if (mode === 'class') {
@@ -317,7 +318,7 @@ let variantPlugins = {
317
318
  exports.variantPlugins = variantPlugins;
318
319
  let corePlugins = {
319
320
  preflight: ({ addBase })=>{
320
- let preflightStyles = _postcss.default.parse(_fs.default.readFileSync(`${__dirname}/css/preflight.css`, 'utf8'));
321
+ let preflightStyles = _postcss.default.parse(_fs.default.readFileSync(path.join(__dirname, './css/preflight.css'), 'utf8'));
321
322
  addBase([
322
323
  _postcss.default.comment({
323
324
  text: `! tailwindcss v${_packageJson.version} | MIT License | https://tailwindcss.com`
@@ -539,7 +540,9 @@ let corePlugins = {
539
540
  ]
540
541
  ],
541
542
  ],
542
- ]),
543
+ ], {
544
+ supportsNegativeValues: true
545
+ }),
543
546
  isolation: ({ addUtilities })=>{
544
547
  addUtilities({
545
548
  '.isolate': {
@@ -557,8 +560,12 @@ let corePlugins = {
557
560
  'zIndex'
558
561
  ]
559
562
  ]
560
- ]),
561
- order: (0, _createUtilityPlugin).default('order'),
563
+ ], {
564
+ supportsNegativeValues: true
565
+ }),
566
+ order: (0, _createUtilityPlugin).default('order', undefined, {
567
+ supportsNegativeValues: true
568
+ }),
562
569
  gridColumn: (0, _createUtilityPlugin).default('gridColumn', [
563
570
  [
564
571
  'col',
@@ -685,7 +692,9 @@ let corePlugins = {
685
692
  ]
686
693
  ],
687
694
  ],
688
- ]),
695
+ ], {
696
+ supportsNegativeValues: true
697
+ }),
689
698
  boxSizing: ({ addUtilities })=>{
690
699
  addUtilities({
691
700
  '.box-border': {
@@ -826,7 +835,13 @@ let corePlugins = {
826
835
  [
827
836
  'flex-shrink'
828
837
  ]
829
- ]
838
+ ],
839
+ [
840
+ 'shrink',
841
+ [
842
+ 'flex-shrink'
843
+ ]
844
+ ],
830
845
  ]),
831
846
  flexGrow: (0, _createUtilityPlugin).default('flexGrow', [
832
847
  [
@@ -834,6 +849,20 @@ let corePlugins = {
834
849
  [
835
850
  'flex-grow'
836
851
  ]
852
+ ],
853
+ [
854
+ 'grow',
855
+ [
856
+ 'flex-grow'
857
+ ]
858
+ ],
859
+ ]),
860
+ flexBasis: (0, _createUtilityPlugin).default('flexBasis', [
861
+ [
862
+ 'basis',
863
+ [
864
+ 'flex-basis'
865
+ ]
837
866
  ]
838
867
  ]),
839
868
  tableLayout: ({ addUtilities })=>{
@@ -897,7 +926,9 @@ let corePlugins = {
897
926
  ],
898
927
  ],
899
928
  ],
900
- ]),
929
+ ], {
930
+ supportsNegativeValues: true
931
+ }),
901
932
  rotate: (0, _createUtilityPlugin).default('rotate', [
902
933
  [
903
934
  'rotate',
@@ -912,9 +943,11 @@ let corePlugins = {
912
943
  'transform',
913
944
  'var(--tw-transform)'
914
945
  ]
915
- ]
946
+ ],
916
947
  ],
917
- ]),
948
+ ], {
949
+ supportsNegativeValues: true
950
+ }),
918
951
  skew: (0, _createUtilityPlugin).default('skew', [
919
952
  [
920
953
  [
@@ -948,7 +981,9 @@ let corePlugins = {
948
981
  ],
949
982
  ],
950
983
  ],
951
- ]),
984
+ ], {
985
+ supportsNegativeValues: true
986
+ }),
952
987
  scale: (0, _createUtilityPlugin).default('scale', [
953
988
  [
954
989
  'scale',
@@ -1260,7 +1295,9 @@ let corePlugins = {
1260
1295
  ]
1261
1296
  ],
1262
1297
  ],
1263
- ]),
1298
+ ], {
1299
+ supportsNegativeValues: true
1300
+ }),
1264
1301
  scrollPadding: (0, _createUtilityPlugin).default('scrollPadding', [
1265
1302
  [
1266
1303
  'scroll-p',
@@ -1658,7 +1695,8 @@ let corePlugins = {
1658
1695
  };
1659
1696
  }
1660
1697
  }, {
1661
- values: theme('space')
1698
+ values: theme('space'),
1699
+ supportsNegativeValues: true
1662
1700
  });
1663
1701
  addUtilities({
1664
1702
  '.space-y-reverse > :not([hidden]) ~ :not([hidden])': {
@@ -2608,7 +2646,9 @@ let corePlugins = {
2608
2646
  'text-indent'
2609
2647
  ]
2610
2648
  ]
2611
- ]),
2649
+ ], {
2650
+ supportsNegativeValues: true
2651
+ }),
2612
2652
  verticalAlign: ({ addUtilities , matchUtilities })=>{
2613
2653
  addUtilities({
2614
2654
  '.align-baseline': {
@@ -2780,7 +2820,9 @@ let corePlugins = {
2780
2820
  'letterSpacing'
2781
2821
  ]
2782
2822
  ]
2783
- ]),
2823
+ ], {
2824
+ supportsNegativeValues: true
2825
+ }),
2784
2826
  textColor: ({ matchUtilities , theme , corePlugins })=>{
2785
2827
  matchUtilities({
2786
2828
  text: (value)=>{
@@ -2821,6 +2863,21 @@ let corePlugins = {
2821
2863
  }
2822
2864
  });
2823
2865
  },
2866
+ textDecorationColor: ({ matchUtilities , theme })=>{
2867
+ matchUtilities({
2868
+ decoration: (value)=>{
2869
+ return {
2870
+ 'text-decoration-color': (0, _toColorValue).default(value)
2871
+ };
2872
+ }
2873
+ }, {
2874
+ values: (0, _flattenColorPalette).default(theme('textDecorationColor')),
2875
+ type: [
2876
+ 'color',
2877
+ 'any'
2878
+ ]
2879
+ });
2880
+ },
2824
2881
  fontSmoothing: ({ addUtilities })=>{
2825
2882
  addUtilities({
2826
2883
  '.antialiased': {
@@ -3229,7 +3286,8 @@ let corePlugins = {
3229
3286
  };
3230
3287
  }
3231
3288
  }, {
3232
- values: theme('hueRotate')
3289
+ values: theme('hueRotate'),
3290
+ supportsNegativeValues: true
3233
3291
  });
3234
3292
  },
3235
3293
  invert: ({ matchUtilities , theme })=>{
@@ -3377,7 +3435,8 @@ let corePlugins = {
3377
3435
  };
3378
3436
  }
3379
3437
  }, {
3380
- values: theme('backdropHueRotate')
3438
+ values: theme('backdropHueRotate'),
3439
+ supportsNegativeValues: true
3381
3440
  });
3382
3441
  },
3383
3442
  backdropInvert: ({ matchUtilities , theme })=>{
@@ -317,6 +317,13 @@ button,
317
317
  cursor: pointer;
318
318
  }
319
319
 
320
+ /*
321
+ Make sure disabled buttons don't get the pointer cursor.
322
+ */
323
+ :disabled {
324
+ cursor: default;
325
+ }
326
+
320
327
  /*
321
328
  1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
322
329
  2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
@@ -12,7 +12,10 @@ function _interopRequireDefault(obj) {
12
12
  default: obj
13
13
  };
14
14
  }
15
- const featureFlags = {
15
+ let defaults = {
16
+ optimizeUniversalDefaults: true
17
+ };
18
+ let featureFlags = {
16
19
  future: [],
17
20
  experimental: [
18
21
  'optimizeUniversalDefaults'
@@ -21,13 +24,13 @@ const featureFlags = {
21
24
  function flagEnabled(config, flag) {
22
25
  if (featureFlags.future.includes(flag)) {
23
26
  var ref;
24
- var ref1;
25
- return config.future === 'all' || ((ref1 = config === null || config === void 0 ? void 0 : (ref = config.future) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref1 !== void 0 ? ref1 : false);
27
+ var ref1, ref2;
28
+ return config.future === 'all' || ((ref2 = (ref1 = config === null || config === void 0 ? void 0 : (ref = config.future) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref1 !== void 0 ? ref1 : defaults[flag]) !== null && ref2 !== void 0 ? ref2 : false);
26
29
  }
27
30
  if (featureFlags.experimental.includes(flag)) {
28
31
  var ref;
29
- var ref5;
30
- return config.experimental === 'all' || ((ref5 = config === null || config === void 0 ? void 0 : (ref = config.experimental) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref5 !== void 0 ? ref5 : false);
32
+ var ref11, ref12;
33
+ return config.experimental === 'all' || ((ref12 = (ref11 = config === null || config === void 0 ? void 0 : (ref = config.experimental) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref11 !== void 0 ? ref11 : defaults[flag]) !== null && ref12 !== void 0 ? ref12 : false);
31
34
  }
32
35
  return false;
33
36
  }
@@ -45,11 +48,11 @@ function issueFlagNotices(config) {
45
48
  return;
46
49
  }
47
50
  if (experimentalFlagsEnabled(config).length > 0) {
48
- const changes = experimentalFlagsEnabled(config).map((s)=>_chalk.default.yellow(s)
51
+ let changes = experimentalFlagsEnabled(config).map((s)=>_chalk.default.yellow(s)
49
52
  ).join(', ');
50
53
  _log.default.warn('experimental-flags-enabled', [
51
54
  `You have enabled experimental features: ${changes}`,
52
- 'Experimental features are not covered by semver, may introduce breaking changes, and can change at any time.',
55
+ 'Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time.',
53
56
  ]);
54
57
  }
55
58
  }
@@ -230,7 +230,6 @@ function expandTailwindAtRules(context) {
230
230
  if (env.DEBUG) {
231
231
  console.log('Potential classes: ', candidates.size);
232
232
  console.log('Active contexts: ', sharedState.contextSourcesMap.size);
233
- console.log('Content match entries', contentMatchCache.size);
234
233
  }
235
234
  // Clear the cache for the changed files
236
235
  context.changedContent = [];
@@ -204,6 +204,12 @@ function* resolveMatchedPlugins(classCandidate, context) {
204
204
  negative = true;
205
205
  candidatePrefix = twConfigPrefix + candidatePrefix.slice(twConfigPrefixLen + 1);
206
206
  }
207
+ if (negative && context.candidateRuleMap.has(candidatePrefix)) {
208
+ yield [
209
+ context.candidateRuleMap.get(candidatePrefix),
210
+ '-DEFAULT'
211
+ ];
212
+ }
207
213
  for (let [prefix, modifier] of candidatePermutations(candidatePrefix)){
208
214
  if (context.candidateRuleMap.has(prefix)) {
209
215
  yield [
@@ -261,7 +267,7 @@ function* resolveMatches(candidate, context) {
261
267
  ]);
262
268
  }
263
269
  }
264
- } else if (modifier === 'DEFAULT') {
270
+ } else if (modifier === 'DEFAULT' || modifier === '-DEFAULT') {
265
271
  let ruleSet = plugin;
266
272
  let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
267
273
  for (let rule of rules){
@@ -315,16 +321,14 @@ function* resolveMatches(candidate, context) {
315
321
  ) // Re-indent
316
322
  .join('\n')
317
323
  ).join('\n\n');
318
- messages.push(` - Replace "${candidate}" with "${candidate.replace('[', `[${type}:`)}" for:\n${rules}\n`);
324
+ messages.push(` Use \`${candidate.replace('[', `[${type}:`)}\` for \`${rules.trim()}\``);
319
325
  break;
320
326
  }
321
327
  }
322
328
  _log.default.warn([
323
- // TODO: Update URL
324
- `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.`,
325
- '',
329
+ `The class \`${candidate}\` is ambiguous and matches multiple utilities.`,
326
330
  ...messages,
327
- `If this is just part of your content and not a class, replace it with "${candidate.replace('[', '&lsqb;').replace(']', '&rsqb;')}" to silence this warning.`,
331
+ `If this is content and not a class, replace it with \`${candidate.replace('[', '&lsqb;').replace(']', '&rsqb;')}\` to silence this warning.`,
328
332
  ]);
329
333
  continue;
330
334
  }
@@ -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);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.default = resolveDefaultsAtRules;
6
+ exports.elementSelectorParser = void 0;
6
7
  var _postcss = _interopRequireDefault(require("postcss"));
7
8
  var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
8
9
  var _featureFlags = require("../featureFlags");
@@ -11,58 +12,53 @@ function _interopRequireDefault(obj) {
11
12
  default: obj
12
13
  };
13
14
  }
14
- function isPseudoElement(n) {
15
- if (n.type !== 'pseudo') {
16
- return false;
15
+ let getNode = {
16
+ id (node) {
17
+ return _postcssSelectorParser.default.attribute({
18
+ attribute: 'id',
19
+ operator: '=',
20
+ value: node.value,
21
+ quoteMark: '"'
22
+ });
17
23
  }
18
- return n.value.startsWith('::') || [
19
- ':before',
20
- ':after',
21
- ':first-line',
22
- ':first-letter'
23
- ].includes(n.value);
24
- }
24
+ };
25
25
  function minimumImpactSelector(nodes) {
26
- let rest = nodes// Keep all pseudo & combinator types (:not([hidden]) ~ :not([hidden]))
27
- .filter((n)=>n.type === 'pseudo' || n.type === 'combinator'
28
- )// Remove leading pseudo's (:hover, :focus, ...)
29
- .filter((n, idx, all)=>{
30
- // Keep pseudo elements
31
- if (isPseudoElement(n)) return true;
32
- if (idx === 0 && n.type === 'pseudo') return false;
33
- if (idx > 0 && n.type === 'pseudo' && all[idx - 1].type === 'pseudo') return false;
34
- return true;
35
- });
36
- let [bestNode] = nodes;
37
- for (let [type, getNode = (n)=>n
38
- ] of [
39
- [
40
- 'class'
41
- ],
42
- [
43
- 'id',
44
- (n)=>_postcssSelectorParser.default.attribute({
45
- attribute: 'id',
46
- operator: '=',
47
- value: n.value,
48
- quoteMark: '"'
49
- })
50
- ,
51
- ],
52
- [
53
- 'attribute'
54
- ],
55
- ]){
56
- let match = nodes.find((n)=>n.type === type
57
- );
58
- if (match) {
59
- bestNode = getNode(match);
60
- break;
61
- }
26
+ let rest = nodes.filter((node)=>{
27
+ // Keep non-pseudo nodes
28
+ if (node.type !== 'pseudo') return true;
29
+ // Keep pseudo nodes that have subnodes
30
+ // E.g.: `:not()` contains subnodes inside the parentheses
31
+ if (node.nodes.length > 0) return true;
32
+ // Keep pseudo `elements`
33
+ // This implicitly means that we ignore pseudo `classes`
34
+ return node.value.startsWith('::') || [
35
+ ':before',
36
+ ':after',
37
+ ':first-line',
38
+ ':first-letter'
39
+ ].includes(node.value);
40
+ }).reverse();
41
+ let searchFor = new Set([
42
+ 'tag',
43
+ 'class',
44
+ 'id',
45
+ 'attribute'
46
+ ]);
47
+ let splitPointIdx = rest.findIndex((n)=>searchFor.has(n.type)
48
+ );
49
+ if (splitPointIdx === -1) return rest.reverse().join('').trim();
50
+ let node = rest[splitPointIdx];
51
+ let bestNode = getNode[node.type] ? getNode[node.type](node) : node;
52
+ rest = rest.slice(0, splitPointIdx);
53
+ let combinatorIdx = rest.findIndex((n)=>n.type === 'combinator' && n.value === '>'
54
+ );
55
+ if (combinatorIdx !== -1) {
56
+ rest.splice(0, combinatorIdx);
57
+ rest.unshift(_postcssSelectorParser.default.universal());
62
58
  }
63
59
  return [
64
60
  bestNode,
65
- ...rest
61
+ ...rest.reverse()
66
62
  ].join('').trim();
67
63
  }
68
64
  let elementSelectorParser = (0, _postcssSelectorParser).default((selectors)=>{
@@ -72,6 +68,7 @@ let elementSelectorParser = (0, _postcssSelectorParser).default((selectors)=>{
72
68
  return minimumImpactSelector(nodes);
73
69
  });
74
70
  });
71
+ exports.elementSelectorParser = elementSelectorParser;
75
72
  let cache = new Map();
76
73
  function extractElementSelector(selector) {
77
74
  if (!cache.has(selector)) {
@@ -22,6 +22,7 @@ var _corePlugins = require("../corePlugins");
22
22
  var sharedState = _interopRequireWildcard(require("./sharedState"));
23
23
  var _toPath = require("../util/toPath");
24
24
  var _log = _interopRequireDefault(require("../util/log"));
25
+ var _negateValue = _interopRequireDefault(require("../util/negateValue"));
25
26
  function _interopRequireDefault(obj) {
26
27
  return obj && obj.__esModule ? obj : {
27
28
  default: obj
@@ -351,19 +352,12 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
351
352
  function wrapped(modifier, { isOnlyPlugin }) {
352
353
  let { type ='any' } = options;
353
354
  type = [].concat(type);
354
- let [value, coercedType] = (0, _pluginUtils).coerceValue(type, modifier, options.values, tailwindConfig);
355
+ let [value, coercedType] = (0, _pluginUtils).coerceValue(type, modifier, options, tailwindConfig);
355
356
  if (value === undefined) {
356
357
  return [];
357
358
  }
358
- if (!type.includes(coercedType)) {
359
- if (isOnlyPlugin) {
360
- _log.default.warn([
361
- `Unnecessary typehint \`${coercedType}\` in \`${identifier}-${modifier}\`.`,
362
- `You can safely update it to \`${identifier}-${modifier.replace(coercedType + ':', '')}\`.`,
363
- ]);
364
- } else {
365
- return [];
366
- }
359
+ if (!type.includes(coercedType) && !isOnlyPlugin) {
360
+ return [];
367
361
  }
368
362
  if (!isValidArbitraryValue(value)) {
369
363
  return [];
@@ -408,7 +402,7 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
408
402
  function wrapped(modifier, { isOnlyPlugin }) {
409
403
  let { type ='any' } = options;
410
404
  type = [].concat(type);
411
- let [value, coercedType] = (0, _pluginUtils).coerceValue(type, modifier, options.values, tailwindConfig);
405
+ let [value, coercedType] = (0, _pluginUtils).coerceValue(type, modifier, options, tailwindConfig);
412
406
  if (value === undefined) {
413
407
  return [];
414
408
  }
@@ -651,9 +645,8 @@ function registerPlugins(plugins, context) {
651
645
  }
652
646
  if (value instanceof RegExp) {
653
647
  _log.default.warn('root-regex', [
654
- // TODO: Improve this warning message
655
- 'RegExp in the safelist option is not supported.',
656
- 'Please use the object syntax instead: https://tailwindcss.com/docs/...',
648
+ 'Regular expressions in `safelist` work differently in Tailwind CSS v3.0.',
649
+ 'Update your `safelist` configuration to eliminate this warning.'
657
650
  ]);
658
651
  continue;
659
652
  }
@@ -697,9 +690,8 @@ function registerPlugins(plugins, context) {
697
690
  for (let [regex, count] of patternMatchingCount.entries()){
698
691
  if (count !== 0) continue;
699
692
  _log.default.warn([
700
- // TODO: Improve this warning message
701
- `You have a regex pattern in your "safelist" config (${regex}) that doesn't match any utilities.`,
702
- 'For more info, visit https://tailwindcss.com/docs/...',
693
+ `The safelist pattern \`${regex}\` doesn't match any Tailwind CSS classes.`,
694
+ 'Fix this pattern or remove it from your `safelist` configuration.',
703
695
  ]);
704
696
  }
705
697
  }
@@ -711,11 +703,16 @@ function registerPlugins(plugins, context) {
711
703
  for (let util of classList){
712
704
  if (Array.isArray(util)) {
713
705
  let [utilName, options] = util;
706
+ let negativeClasses = [];
714
707
  var ref;
715
- for (let value of Object.keys((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {
708
+ for (let [key, value] of Object.entries((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {
716
709
  })){
717
- output.push((0, _nameClass).formatClass(utilName, value));
710
+ output.push((0, _nameClass).formatClass(utilName, key));
711
+ if ((options === null || options === void 0 ? void 0 : options.supportsNegativeValues) && (0, _negateValue).default(value)) {
712
+ negativeClasses.push((0, _nameClass).formatClass(utilName, `-${key}`));
713
+ }
718
714
  }
715
+ output.push(...negativeClasses);
719
716
  } else {
720
717
  output.push(util);
721
718
  }
@@ -75,7 +75,11 @@ function rebootWatcher(context, configPath, configDependencies, candidateFiles)
75
75
  ...candidateFiles,
76
76
  ...configDependencies
77
77
  ], {
78
- ignoreInitial: true
78
+ ignoreInitial: true,
79
+ awaitWriteFinish: process.platform === 'win32' ? {
80
+ stabilityThreshold: 50,
81
+ pollInterval: 10
82
+ } : false
79
83
  });
80
84
  setWatcher(context, watcher);
81
85
  watcher.on('add', (file)=>{