tailwindcss 0.0.0-insiders.ca1dfd6 → 0.0.0-insiders.d1f066d

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 (65) hide show
  1. package/CHANGELOG.md +60 -1
  2. package/lib/cli.js +73 -74
  3. package/lib/constants.js +1 -1
  4. package/lib/corePluginList.js +7 -1
  5. package/lib/corePlugins.js +295 -228
  6. package/lib/css/preflight.css +12 -0
  7. package/lib/featureFlags.js +12 -9
  8. package/lib/lib/collapseDuplicateDeclarations.js +29 -0
  9. package/lib/lib/evaluateTailwindFunctions.js +3 -3
  10. package/lib/lib/expandApplyAtRules.js +7 -7
  11. package/lib/lib/expandTailwindAtRules.js +14 -26
  12. package/lib/lib/generateRules.js +170 -27
  13. package/lib/lib/normalizeTailwindDirectives.js +3 -2
  14. package/lib/lib/resolveDefaultsAtRules.js +44 -47
  15. package/lib/lib/setupContextUtils.js +192 -123
  16. package/lib/lib/setupTrackingContext.js +3 -3
  17. package/lib/lib/setupWatchingContext.js +8 -4
  18. package/lib/lib/sharedState.js +2 -12
  19. package/lib/processTailwindFeatures.js +4 -0
  20. package/lib/public/colors.js +4 -8
  21. package/lib/util/createUtilityPlugin.js +5 -5
  22. package/lib/util/dataTypes.js +24 -4
  23. package/lib/util/formatVariantSelector.js +102 -0
  24. package/lib/util/log.js +30 -18
  25. package/lib/util/nameClass.js +1 -1
  26. package/lib/util/negateValue.js +3 -1
  27. package/lib/util/normalizeConfig.js +208 -0
  28. package/lib/util/parseBoxShadowValue.js +77 -0
  29. package/lib/util/pluginUtils.js +62 -158
  30. package/lib/util/prefixSelector.js +1 -3
  31. package/lib/util/resolveConfig.js +18 -77
  32. package/lib/util/transformThemeValue.js +23 -13
  33. package/package.json +11 -11
  34. package/peers/index.js +955 -2671
  35. package/scripts/create-plugin-list.js +2 -2
  36. package/src/cli.js +19 -13
  37. package/src/corePluginList.js +1 -1
  38. package/src/corePlugins.js +303 -366
  39. package/src/css/preflight.css +12 -0
  40. package/src/featureFlags.js +12 -6
  41. package/src/lib/collapseDuplicateDeclarations.js +28 -0
  42. package/src/lib/expandTailwindAtRules.js +15 -29
  43. package/src/lib/generateRules.js +194 -19
  44. package/src/lib/normalizeTailwindDirectives.js +3 -2
  45. package/src/lib/resolveDefaultsAtRules.js +39 -43
  46. package/src/lib/setupContextUtils.js +183 -105
  47. package/src/lib/setupTrackingContext.js +3 -5
  48. package/src/lib/setupWatchingContext.js +10 -5
  49. package/src/lib/sharedState.js +1 -4
  50. package/src/processTailwindFeatures.js +5 -0
  51. package/src/public/colors.js +4 -9
  52. package/src/util/createUtilityPlugin.js +2 -2
  53. package/src/util/dataTypes.js +32 -5
  54. package/src/util/formatVariantSelector.js +105 -0
  55. package/src/util/log.js +18 -21
  56. package/src/util/nameClass.js +1 -1
  57. package/src/util/negateValue.js +4 -2
  58. package/src/util/normalizeConfig.js +249 -0
  59. package/src/util/parseBoxShadowValue.js +71 -0
  60. package/src/util/pluginUtils.js +50 -146
  61. package/src/util/prefixSelector.js +1 -4
  62. package/src/util/resolveConfig.js +11 -64
  63. package/src/util/transformThemeValue.js +22 -7
  64. package/stubs/defaultConfig.stub.js +134 -91
  65. package/stubs/simpleConfig.stub.js +0 -1
@@ -12,6 +12,11 @@
12
12
  border-color: currentColor; /* 2 */
13
13
  }
14
14
 
15
+ ::before,
16
+ ::after {
17
+ --tw-content: '';
18
+ }
19
+
15
20
  /*
16
21
  1. Use a consistent sensible line-height in all browsers.
17
22
  2. Prevent adjustments of font size after orientation changes in iOS.
@@ -317,6 +322,13 @@ button,
317
322
  cursor: pointer;
318
323
  }
319
324
 
325
+ /*
326
+ Make sure disabled buttons don't get the pointer cursor.
327
+ */
328
+ :disabled {
329
+ cursor: default;
330
+ }
331
+
320
332
  /*
321
333
  1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
322
334
  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
- 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);
31
+ var ref3;
32
+ var ref4, ref5;
33
+ return config.experimental === 'all' || ((ref5 = (ref4 = config === null || config === void 0 ? void 0 : (ref3 = config.experimental) === null || ref3 === void 0 ? void 0 : ref3[flag]) !== null && ref4 !== void 0 ? ref4 : defaults[flag]) !== null && ref5 !== void 0 ? ref5 : 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
- _log.default.warn([
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
  }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = collapseDuplicateDeclarations;
6
+ function collapseDuplicateDeclarations() {
7
+ return (root)=>{
8
+ root.walkRules((node)=>{
9
+ let seen = new Map();
10
+ let droppable = new Set([]);
11
+ node.walkDecls((decl)=>{
12
+ // This could happen if we have nested selectors. In that case the
13
+ // parent will loop over all its declarations but also the declarations
14
+ // of nested rules. With this we ensure that we are shallowly checking
15
+ // declarations.
16
+ if (decl.parent !== node) {
17
+ return;
18
+ }
19
+ if (seen.has(decl.prop)) {
20
+ droppable.add(seen.get(decl.prop));
21
+ }
22
+ seen.set(decl.prop, decl);
23
+ });
24
+ for (let decl1 of droppable){
25
+ decl1.remove();
26
+ }
27
+ });
28
+ };
29
+ }
@@ -112,11 +112,11 @@ function extractArgs(node, vNodes, functions) {
112
112
  let args = [
113
113
  ''
114
114
  ];
115
- for (let vNode of vNodes){
116
- if (vNode.type === 'div' && vNode.value === ',') {
115
+ for (let vNode1 of vNodes){
116
+ if (vNode1.type === 'div' && vNode1.value === ',') {
117
117
  args.push('');
118
118
  } else {
119
- args[args.length - 1] += _postcssValueParser.default.stringify(vNode);
119
+ args[args.length - 1] += _postcssValueParser.default.stringify(vNode1);
120
120
  }
121
121
  }
122
122
  return args;
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) {
12
12
  default: obj
13
13
  };
14
14
  }
15
- function prefix(context, selector) {
15
+ function prefix1(context, selector) {
16
16
  let prefix = context.tailwindConfig.prefix;
17
17
  return typeof prefix === 'function' ? prefix(selector) : prefix + selector;
18
18
  }
@@ -56,10 +56,10 @@ function partitionApplyParents(root) {
56
56
  root.walkAtRules('apply', (rule)=>{
57
57
  applyParents.add(rule.parent);
58
58
  });
59
- for (let rule of applyParents){
59
+ for (let rule1 of applyParents){
60
60
  let nodeGroups = [];
61
61
  let lastGroup = [];
62
- for (let node of rule.nodes){
62
+ for (let node of rule1.nodes){
63
63
  if (node.type === 'atrule' && node.name === 'apply') {
64
64
  if (lastGroup.length > 0) {
65
65
  nodeGroups.push(lastGroup);
@@ -81,13 +81,13 @@ function partitionApplyParents(root) {
81
81
  for (let group of [
82
82
  ...nodeGroups
83
83
  ].reverse()){
84
- let newParent = rule.clone({
84
+ let newParent = rule1.clone({
85
85
  nodes: []
86
86
  });
87
87
  newParent.append(group);
88
- rule.after(newParent);
88
+ rule1.after(newParent);
89
89
  }
90
- rule.remove();
90
+ rule1.remove();
91
91
  }
92
92
  }
93
93
  function processApply(root, context) {
@@ -156,7 +156,7 @@ function processApply(root, context) {
156
156
  }
157
157
  for (let applyCandidate of applyCandidates){
158
158
  if (!applyClassCache.has(applyCandidate)) {
159
- if (applyCandidate === prefix(context, 'group')) {
159
+ if (applyCandidate === prefix1(context, 'group')) {
160
160
  // TODO: Link to specific documentation page with error code.
161
161
  throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`);
162
162
  }
@@ -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,12 +37,13 @@ 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,
43
43
  /([^<>"'`\s]*\[\w*\('[^"'`\s]*'\)\])/.source,
44
44
  /([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source,
45
+ /([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source,
46
+ /([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
45
47
  /([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
46
48
  /([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
47
49
  /([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source,
@@ -66,43 +68,30 @@ const builtInTransformers = {
66
68
  };
67
69
  function getExtractor(tailwindConfig, fileExtension) {
68
70
  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
71
  return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || builtInExtractors.DEFAULT;
84
72
  }
85
73
  function getTransformer(tailwindConfig, fileExtension) {
86
74
  let transformers = tailwindConfig.content.transform;
87
- if (typeof transformers === 'function') {
88
- transformers = {
89
- DEFAULT: transformers
90
- };
91
- }
92
75
  return transformers[fileExtension] || transformers.DEFAULT || builtInTransformers[fileExtension] || builtInTransformers.DEFAULT;
93
76
  }
77
+ let extractorCache = new WeakMap();
94
78
  // Scans template contents for possible classes. This is a hot path on initial build but
95
79
  // not too important for subsequent builds. The faster the better though — if we can speed
96
80
  // up these regexes by 50% that could cut initial build time by like 20%.
97
- function getClassCandidates(content, extractor, contentMatchCache, candidates, seen) {
81
+ function getClassCandidates(content, extractor, candidates, seen) {
82
+ if (!extractorCache.has(extractor)) {
83
+ extractorCache.set(extractor, new _quickLru.default({
84
+ maxSize: 25000
85
+ }));
86
+ }
98
87
  for (let line of content.split('\n')){
99
88
  line = line.trim();
100
89
  if (seen.has(line)) {
101
90
  continue;
102
91
  }
103
92
  seen.add(line);
104
- if (contentMatchCache.has(line)) {
105
- for (let match of contentMatchCache.get(line)){
93
+ if (extractorCache.get(extractor).has(line)) {
94
+ for (let match of extractorCache.get(extractor).get(line)){
106
95
  candidates.add(match);
107
96
  }
108
97
  } else {
@@ -112,7 +101,7 @@ function getClassCandidates(content, extractor, contentMatchCache, candidates, s
112
101
  for (let match of lineMatchesSet){
113
102
  candidates.add(match);
114
103
  }
115
- contentMatchCache.set(line, lineMatchesSet);
104
+ extractorCache.get(extractor).set(line, lineMatchesSet);
116
105
  }
117
106
  }
118
107
  }
@@ -189,7 +178,7 @@ function expandTailwindAtRules(context) {
189
178
  for (let { content , extension } of context.changedContent){
190
179
  let transformer = getTransformer(context.tailwindConfig, extension);
191
180
  let extractor = getExtractor(context.tailwindConfig, extension);
192
- getClassCandidates(transformer(content), extractor, contentMatchCache, candidates, seen);
181
+ getClassCandidates(transformer(content), extractor, candidates, seen);
193
182
  }
194
183
  // ---
195
184
  // Generate the actual CSS
@@ -243,7 +232,6 @@ function expandTailwindAtRules(context) {
243
232
  if (env.DEBUG) {
244
233
  console.log('Potential classes: ', candidates.size);
245
234
  console.log('Active contexts: ', sharedState.contextSourcesMap.size);
246
- console.log('Content match entries', contentMatchCache.size);
247
235
  }
248
236
  // Clear the cache for the changed files
249
237
  context.changedContent = [];
@@ -9,6 +9,8 @@ var _parseObjectStyles = _interopRequireDefault(require("../util/parseObjectStyl
9
9
  var _isPlainObject = _interopRequireDefault(require("../util/isPlainObject"));
10
10
  var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
11
11
  var _pluginUtils = require("../util/pluginUtils");
12
+ var _log = _interopRequireDefault(require("../util/log"));
13
+ var _formatVariantSelector = require("../util/formatVariantSelector");
12
14
  function _interopRequireDefault(obj) {
13
15
  return obj && obj.__esModule ? obj : {
14
16
  default: obj
@@ -118,22 +120,23 @@ function applyVariant(variant, matches, context) {
118
120
  if (context.variantMap.has(variant)) {
119
121
  let variantFunctionTuples = context.variantMap.get(variant);
120
122
  let result = [];
121
- for (let [meta, rule] of matches){
122
- if (meta.options.respectVariants === false) {
123
- result.push([
124
- meta,
125
- rule
126
- ]);
127
- continue;
128
- }
123
+ for (let [meta, rule1] of matches){
129
124
  let container = _postcss.default.root({
130
125
  nodes: [
131
- rule.clone()
126
+ rule1.clone()
132
127
  ]
133
128
  });
134
129
  for (let [variantSort, variantFunction] of variantFunctionTuples){
135
130
  let clone = container.clone();
131
+ let collectedFormats = [];
132
+ let originals = new Map();
133
+ function prepareBackup() {
134
+ if (originals.size > 0) return; // Already prepared, chicken out
135
+ clone.walkRules((rule)=>originals.set(rule, rule.selector)
136
+ );
137
+ }
136
138
  function modifySelectors(modifierFunction) {
139
+ prepareBackup();
137
140
  clone.each((rule)=>{
138
141
  if (rule.type !== 'rule') {
139
142
  return;
@@ -150,19 +153,71 @@ function applyVariant(variant, matches, context) {
150
153
  return clone;
151
154
  }
152
155
  let ruleWithVariant = variantFunction({
153
- container: clone,
156
+ // Public API
157
+ get container () {
158
+ prepareBackup();
159
+ return clone;
160
+ },
154
161
  separator: context.tailwindConfig.separator,
155
- modifySelectors
162
+ modifySelectors,
163
+ // Private API for now
164
+ wrap (wrapper) {
165
+ let nodes = clone.nodes;
166
+ clone.removeAll();
167
+ wrapper.append(nodes);
168
+ clone.append(wrapper);
169
+ },
170
+ format (selectorFormat) {
171
+ collectedFormats.push(selectorFormat);
172
+ }
156
173
  });
174
+ if (typeof ruleWithVariant === 'string') {
175
+ collectedFormats.push(ruleWithVariant);
176
+ }
157
177
  if (ruleWithVariant === null) {
158
178
  continue;
159
179
  }
180
+ // We filled the `originals`, therefore we assume that somebody touched
181
+ // `container` or `modifySelectors`. Let's see if they did, so that we
182
+ // can restore the selectors, and collect the format strings.
183
+ if (originals.size > 0) {
184
+ clone.walkRules((rule)=>{
185
+ if (!originals.has(rule)) return;
186
+ let before = originals.get(rule);
187
+ if (before === rule.selector) return; // No mutation happened
188
+ let modified = rule.selector;
189
+ // Rebuild the base selector, this is what plugin authors would do
190
+ // as well. E.g.: `${variant}${separator}${className}`.
191
+ // However, plugin authors probably also prepend or append certain
192
+ // classes, pseudos, ids, ...
193
+ let rebuiltBase = (0, _postcssSelectorParser).default((selectors)=>{
194
+ selectors.walkClasses((classNode)=>{
195
+ classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
196
+ });
197
+ }).processSync(before);
198
+ // Now that we know the original selector, the new selector, and
199
+ // the rebuild part in between, we can replace the part that plugin
200
+ // authors need to rebuild with `&`, and eventually store it in the
201
+ // collectedFormats. Similar to what `format('...')` would do.
202
+ //
203
+ // E.g.:
204
+ // variant: foo
205
+ // selector: .markdown > p
206
+ // modified (by plugin): .foo .foo\\:markdown > p
207
+ // rebuiltBase (internal): .foo\\:markdown > p
208
+ // format: .foo &
209
+ collectedFormats.push(modified.replace(rebuiltBase, '&'));
210
+ rule.selector = before;
211
+ });
212
+ }
213
+ var _collectedFormats;
160
214
  let withOffset = [
161
215
  {
162
216
  ...meta,
163
- sort: variantSort | meta.sort
217
+ sort: variantSort | meta.sort,
218
+ collectedFormats: ((_collectedFormats = meta.collectedFormats) !== null && _collectedFormats !== void 0 ? _collectedFormats : []).concat(collectedFormats)
164
219
  },
165
- clone.nodes[0]
220
+ clone.nodes[0],
166
221
  ];
167
222
  result.push(withOffset);
168
223
  }
@@ -204,12 +259,18 @@ function* resolveMatchedPlugins(classCandidate, context) {
204
259
  }
205
260
  let candidatePrefix = classCandidate;
206
261
  let negative = false;
207
- const twConfigPrefix = context.tailwindConfig.prefix || '';
262
+ const twConfigPrefix = context.tailwindConfig.prefix;
208
263
  const twConfigPrefixLen = twConfigPrefix.length;
209
264
  if (candidatePrefix[twConfigPrefixLen] === '-') {
210
265
  negative = true;
211
266
  candidatePrefix = twConfigPrefix + candidatePrefix.slice(twConfigPrefixLen + 1);
212
267
  }
268
+ if (negative && context.candidateRuleMap.has(candidatePrefix)) {
269
+ yield [
270
+ context.candidateRuleMap.get(candidatePrefix),
271
+ '-DEFAULT'
272
+ ];
273
+ }
213
274
  for (let [prefix, modifier] of candidatePermutations(candidatePrefix)){
214
275
  if (context.candidateRuleMap.has(prefix)) {
215
276
  yield [
@@ -244,16 +305,18 @@ function* resolveMatches(candidate, context) {
244
305
  // }
245
306
  for (let matchedPlugins of resolveMatchedPlugins(classCandidate, context)){
246
307
  let matches = [];
308
+ let typesByMatches = new Map();
247
309
  let [plugins, modifier] = matchedPlugins;
248
310
  let isOnlyPlugin = plugins.length === 1;
249
311
  for (let [sort, plugin] of plugins){
312
+ let matchesPerPlugin = [];
250
313
  if (typeof plugin === 'function') {
251
314
  for (let ruleSet of [].concat(plugin(modifier, {
252
315
  isOnlyPlugin
253
316
  }))){
254
317
  let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
255
318
  for (let rule of rules){
256
- matches.push([
319
+ matchesPerPlugin.push([
257
320
  {
258
321
  ...sort,
259
322
  options: {
@@ -265,11 +328,11 @@ function* resolveMatches(candidate, context) {
265
328
  ]);
266
329
  }
267
330
  }
268
- } else if (modifier === 'DEFAULT') {
331
+ } else if (modifier === 'DEFAULT' || modifier === '-DEFAULT') {
269
332
  let ruleSet = plugin;
270
333
  let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
271
334
  for (let rule of rules){
272
- matches.push([
335
+ matchesPerPlugin.push([
273
336
  {
274
337
  ...sort,
275
338
  options: {
@@ -281,16 +344,82 @@ function* resolveMatches(candidate, context) {
281
344
  ]);
282
345
  }
283
346
  }
347
+ if (matchesPerPlugin.length > 0) {
348
+ var ref;
349
+ typesByMatches.set(matchesPerPlugin, (ref = sort.options) === null || ref === void 0 ? void 0 : ref.type);
350
+ matches.push(matchesPerPlugin);
351
+ }
352
+ }
353
+ // Only keep the result of the very first plugin if we are dealing with
354
+ // arbitrary values, to protect against ambiguity.
355
+ if (isArbitraryValue(modifier) && matches.length > 1) {
356
+ var ref1;
357
+ let typesPerPlugin = matches.map((match)=>new Set([
358
+ ...(ref1 = typesByMatches.get(match)) !== null && ref1 !== void 0 ? ref1 : []
359
+ ])
360
+ );
361
+ // Remove duplicates, so that we can detect proper unique types for each plugin.
362
+ for (let pluginTypes of typesPerPlugin){
363
+ for (let type of pluginTypes){
364
+ let removeFromOwnGroup = false;
365
+ for (let otherGroup of typesPerPlugin){
366
+ if (pluginTypes === otherGroup) continue;
367
+ if (otherGroup.has(type)) {
368
+ otherGroup.delete(type);
369
+ removeFromOwnGroup = true;
370
+ }
371
+ }
372
+ if (removeFromOwnGroup) pluginTypes.delete(type);
373
+ }
374
+ }
375
+ let messages = [];
376
+ for (let [idx, group] of typesPerPlugin.entries()){
377
+ for (let type of group){
378
+ let rules = matches[idx].map(([, rule])=>rule
379
+ ).flat().map((rule)=>rule.toString().split('\n').slice(1, -1) // Remove selector and closing '}'
380
+ .map((line)=>line.trim()
381
+ ).map((x)=>` ${x}`
382
+ ) // Re-indent
383
+ .join('\n')
384
+ ).join('\n\n');
385
+ messages.push(` Use \`${candidate.replace('[', `[${type}:`)}\` for \`${rules.trim()}\``);
386
+ break;
387
+ }
388
+ }
389
+ _log.default.warn([
390
+ `The class \`${candidate}\` is ambiguous and matches multiple utilities.`,
391
+ ...messages,
392
+ `If this is content and not a class, replace it with \`${candidate.replace('[', '&lsqb;').replace(']', '&rsqb;')}\` to silence this warning.`,
393
+ ]);
394
+ continue;
284
395
  }
285
- matches = applyPrefix(matches, context);
396
+ matches = applyPrefix(matches.flat(), context);
286
397
  if (important) {
287
398
  matches = applyImportant(matches, context);
288
399
  }
289
400
  for (let variant of variants){
290
401
  matches = applyVariant(variant, matches, context);
291
402
  }
292
- for (let match of matches){
293
- yield match;
403
+ for (let match1 of matches){
404
+ // Apply final format selector
405
+ if (match1[0].collectedFormats) {
406
+ let finalFormat = (0, _formatVariantSelector).formatVariantSelector('&', ...match1[0].collectedFormats);
407
+ let container = _postcss.default.root({
408
+ nodes: [
409
+ match1[1].clone()
410
+ ]
411
+ });
412
+ container.walkRules((rule)=>{
413
+ if (inKeyframes(rule)) return;
414
+ rule.selector = (0, _formatVariantSelector).finalizeSelector(finalFormat, {
415
+ selector: rule.selector,
416
+ candidate,
417
+ context
418
+ });
419
+ });
420
+ match1[1] = container.nodes[0];
421
+ }
422
+ yield match1;
294
423
  }
295
424
  }
296
425
  }
@@ -315,15 +444,28 @@ function generateRules(candidates, context) {
315
444
  context.classCache.set(candidate, matches);
316
445
  allRules.push(matches);
317
446
  }
318
- return allRules.flat(1).map(([{ sort , layer , options }, rule])=>{
319
- if (options.respectImportant) {
320
- if (context.tailwindConfig.important === true) {
447
+ // Strategy based on `tailwindConfig.important`
448
+ let strategy = ((important)=>{
449
+ if (important === true) {
450
+ return (rule)=>{
321
451
  rule.walkDecls((d)=>{
322
452
  if (d.parent.type === 'rule' && !inKeyframes(d.parent)) {
323
453
  d.important = true;
324
454
  }
325
455
  });
326
- } else if (typeof context.tailwindConfig.important === 'string') {
456
+ };
457
+ }
458
+ if (typeof important === 'string') {
459
+ return (rule)=>{
460
+ rule.selectors = rule.selectors.map((selector)=>{
461
+ return `${important} ${selector}`;
462
+ });
463
+ };
464
+ }
465
+ })(context.tailwindConfig.important);
466
+ return allRules.flat(1).map(([{ sort , layer , options }, rule])=>{
467
+ if (options.respectImportant) {
468
+ if (strategy) {
327
469
  let container = _postcss.default.root({
328
470
  nodes: [
329
471
  rule.clone()
@@ -333,9 +475,7 @@ function generateRules(candidates, context) {
333
475
  if (inKeyframes(r)) {
334
476
  return;
335
477
  }
336
- r.selectors = r.selectors.map((selector)=>{
337
- return `${context.tailwindConfig.important} ${selector}`;
338
- });
478
+ strategy(r);
339
479
  });
340
480
  rule = container.nodes[0];
341
481
  }
@@ -346,5 +486,8 @@ function generateRules(candidates, context) {
346
486
  ];
347
487
  });
348
488
  }
489
+ function isArbitraryValue(input) {
490
+ return input.startsWith('[') && input.endsWith(']');
491
+ }
349
492
  exports.resolveMatches = resolveMatches;
350
493
  exports.generateRules = generateRules;
@@ -43,8 +43,9 @@ function normalizeTailwindDirectives(root) {
43
43
  'responsive',
44
44
  'variants'
45
45
  ].includes(atRule.name)) {
46
- _log.default.warn([
47
- `'@${atRule.name}' is deprecated, use '@layer utilities' or '@layer components' instead.`,
46
+ _log.default.warn(`${atRule.name}-at-rule-deprecated`, [
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);