tailwindcss 3.0.19 → 3.0.23

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,7 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- Nothing yet!
10
+ - Nothing yet!
11
+
12
+ ## [3.0.23] - 2022-02-16
13
+
14
+ ### Fixed
15
+
16
+ - Remove opacity variables from `:visited` pseudo class ([#7458](https://github.com/tailwindlabs/tailwindcss/pull/7458))
17
+ - Support arbitrary values + calc + theme with quotes ([#7462](https://github.com/tailwindlabs/tailwindcss/pull/7462))
18
+ - Don't duplicate layer output when scanning content with variants + wildcards ([#7478](https://github.com/tailwindlabs/tailwindcss/pull/7478))
19
+ - Implement `getClassOrder` instead of `sortClassList` ([#7459](https://github.com/tailwindlabs/tailwindcss/pull/7459))
20
+
21
+ ## [3.0.22] - 2022-02-11
22
+
23
+ ### Fixed
24
+
25
+ - Temporarily move postcss to dependencies ([#7424](https://github.com/tailwindlabs/tailwindcss/pull/7424))
26
+
27
+ ## [3.0.21] - 2022-02-10
28
+
29
+ ### Fixed
30
+
31
+ - Move prettier plugin to dev dependencies ([#7418](https://github.com/tailwindlabs/tailwindcss/pull/7418))
32
+
33
+ ## [3.0.20] - 2022-02-10
34
+
35
+ ### Added
36
+
37
+ - Expose `context.sortClassList(classes)` ([#7412](https://github.com/tailwindlabs/tailwindcss/pull/7412))
11
38
 
12
39
  ## [3.0.19] - 2022-02-07
13
40
 
@@ -1847,7 +1874,11 @@ No release notes
1847
1874
 
1848
1875
  - Everything!
1849
1876
 
1850
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.19...HEAD
1877
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.23...HEAD
1878
+ [3.0.23]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.22...v3.0.23
1879
+ [3.0.22]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.21...v3.0.22
1880
+ [3.0.21]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.20...v3.0.21
1881
+ [3.0.20]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.19...v3.0.20
1851
1882
  [3.0.19]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.18...v3.0.19
1852
1883
  [3.0.18]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.17...v3.0.18
1853
1884
  [3.0.17]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.16...v3.0.17
@@ -116,7 +116,28 @@ let variantPlugins = {
116
116
  'last-of-type',
117
117
  'only-of-type',
118
118
  // State
119
- 'visited',
119
+ [
120
+ 'visited',
121
+ ({ container })=>{
122
+ let toRemove = [
123
+ '--tw-text-opacity',
124
+ '--tw-border-opacity',
125
+ '--tw-bg-opacity'
126
+ ];
127
+ container.walkDecls((decl)=>{
128
+ if (toRemove.includes(decl.prop)) {
129
+ decl.remove();
130
+ return;
131
+ }
132
+ for (const varName of toRemove){
133
+ if (decl.value.includes(`/ var(${varName})`)) {
134
+ decl.value = decl.value.replace(`/ var(${varName})`, '');
135
+ }
136
+ }
137
+ });
138
+ return ':visited';
139
+ },
140
+ ],
120
141
  'target',
121
142
  [
122
143
  'open',
@@ -149,13 +170,22 @@ let variantPlugins = {
149
170
  ]
150
171
  );
151
172
  for (let [variantName, state] of pseudoVariants){
152
- addVariant(variantName, `&${state}`);
173
+ addVariant(variantName, (ctx)=>{
174
+ let result = typeof state === 'function' ? state(ctx) : state;
175
+ return `&${result}`;
176
+ });
153
177
  }
154
178
  for (let [variantName1, state1] of pseudoVariants){
155
- addVariant(`group-${variantName1}`, `:merge(.group)${state1} &`);
179
+ addVariant(`group-${variantName1}`, (ctx)=>{
180
+ let result = typeof state1 === 'function' ? state1(ctx) : state1;
181
+ return `:merge(.group)${result} &`;
182
+ });
156
183
  }
157
184
  for (let [variantName2, state2] of pseudoVariants){
158
- addVariant(`peer-${variantName2}`, `:merge(.peer)${state2} ~ &`);
185
+ addVariant(`peer-${variantName2}`, (ctx)=>{
186
+ let result = typeof state2 === 'function' ? state2(ctx) : state2;
187
+ return `:merge(.peer)${result} ~ &`;
188
+ });
159
189
  }
160
190
  },
161
191
  directionVariants: ({ addVariant })=>{
@@ -13,6 +13,8 @@ const PATTERNS = [
13
13
  /([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source,
14
14
  /([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source,
15
15
  /([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
16
+ /([^<>"'`\s]*\[[^<>"'`\s]*\('[^"`\s]*'\)+\])/.source,
17
+ /([^<>"'`\s]*\[[^<>"'`\s]*\("[^'`\s]*"\)+\])/.source,
16
18
  /([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
17
19
  /([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
18
20
  /([^<>"'`\s]*\[[^<>"'`\s]*:[^\]\s]*\])/.source,
@@ -140,11 +140,14 @@ function processApply(root, context) {
140
140
  throw apply.error(`@apply is not supported within nested at-rules like @${apply.parent.name}. You can fix this by un-nesting @${apply.parent.name}.`);
141
141
  }
142
142
  for (let applyCandidate of applyCandidates){
143
+ if ([
144
+ prefix(context, 'group'),
145
+ prefix(context, 'peer')
146
+ ].includes(applyCandidate)) {
147
+ // TODO: Link to specific documentation page with error code.
148
+ throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`);
149
+ }
143
150
  if (!applyClassCache.has(applyCandidate)) {
144
- if (applyCandidate === prefix(context, 'group')) {
145
- // TODO: Link to specific documentation page with error code.
146
- throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`);
147
- }
148
151
  throw apply.error(`The \`${applyCandidate}\` class does not exist. If \`${applyCandidate}\` is a custom class, make sure it is defined within a \`@layer\` directive.`);
149
152
  }
150
153
  let rules = applyClassCache.get(applyCandidate);
@@ -157,7 +157,7 @@ function expandTailwindAtRules(context) {
157
157
  // ---
158
158
  // Find potential rules in changed files
159
159
  let candidates = new Set([
160
- '*'
160
+ sharedState.NOT_ON_DEMAND
161
161
  ]);
162
162
  let seen = new Set();
163
163
  env.DEBUG && console.time('Reading changed files');
@@ -10,6 +10,7 @@ var _isPlainObject = _interopRequireDefault(require("../util/isPlainObject"));
10
10
  var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
11
11
  var _pluginUtils = require("../util/pluginUtils");
12
12
  var _log = _interopRequireDefault(require("../util/log"));
13
+ var sharedState = _interopRequireWildcard(require("./sharedState"));
13
14
  var _formatVariantSelector = require("../util/formatVariantSelector");
14
15
  var _nameClass = require("../util/nameClass");
15
16
  var _dataTypes = require("../util/dataTypes");
@@ -19,6 +20,27 @@ function _interopRequireDefault(obj) {
19
20
  default: obj
20
21
  };
21
22
  }
23
+ function _interopRequireWildcard(obj) {
24
+ if (obj && obj.__esModule) {
25
+ return obj;
26
+ } else {
27
+ var newObj = {};
28
+ if (obj != null) {
29
+ for(var key in obj){
30
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
31
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
32
+ if (desc.get || desc.set) {
33
+ Object.defineProperty(newObj, key, desc);
34
+ } else {
35
+ newObj[key] = obj[key];
36
+ }
37
+ }
38
+ }
39
+ }
40
+ newObj.default = obj;
41
+ return newObj;
42
+ }
43
+ }
22
44
  let classNameParser = (0, _postcssSelectorParser).default((selectors)=>{
23
45
  return selectors.first.filter(({ type })=>type === 'class'
24
46
  ).pop().value;
@@ -228,6 +250,7 @@ function applyVariant(variant, matches, context) {
228
250
  // .sm:underline {} is a variant of something in the utilities layer
229
251
  // .sm:container {} is a variant of the container component
230
252
  clone.nodes[0].raws.tailwind = {
253
+ ...clone.nodes[0].raws.tailwind,
231
254
  parentLayer: meta.layer
232
255
  };
233
256
  var _collectedFormats;
@@ -374,11 +397,17 @@ function* resolveMatchedPlugins(classCandidate, context) {
374
397
  }
375
398
  }
376
399
  function splitWithSeparator(input, separator) {
400
+ if (input === sharedState.NOT_ON_DEMAND) {
401
+ return [
402
+ sharedState.NOT_ON_DEMAND
403
+ ];
404
+ }
377
405
  return input.split(new RegExp(`\\${separator}(?![^[]*\\])`, 'g'));
378
406
  }
379
407
  function* recordCandidates(matches, classCandidate) {
380
408
  for (const match of matches){
381
409
  match[1].raws.tailwind = {
410
+ ...match[1].raws.tailwind,
382
411
  classCandidate
383
412
  };
384
413
  yield match;
@@ -503,6 +532,10 @@ function* resolveMatches(candidate, context) {
503
532
  matches = applyVariant(variant, matches, context);
504
533
  }
505
534
  for (let match1 of matches){
535
+ match1[1].raws.tailwind = {
536
+ ...match1[1].raws.tailwind,
537
+ candidate
538
+ };
506
539
  // Apply final format selector
507
540
  if (match1[0].collectedFormats) {
508
541
  let finalFormat = (0, _formatVariantSelector).formatVariantSelector('&', ...match1[0].collectedFormats);
@@ -24,6 +24,7 @@ var _toPath = require("../util/toPath");
24
24
  var _log = _interopRequireDefault(require("../util/log"));
25
25
  var _negateValue = _interopRequireDefault(require("../util/negateValue"));
26
26
  var _isValidArbitraryValue = _interopRequireDefault(require("../util/isValidArbitraryValue"));
27
+ var _generateRules = require("./generateRules");
27
28
  function _interopRequireDefault(obj) {
28
29
  return obj && obj.__esModule ? obj : {
29
30
  default: obj
@@ -50,6 +51,10 @@ function _interopRequireWildcard(obj) {
50
51
  return newObj;
51
52
  }
52
53
  }
54
+ function prefix(context, selector) {
55
+ let prefix1 = context.tailwindConfig.prefix;
56
+ return typeof prefix1 === 'function' ? prefix1(selector) : prefix1 + selector;
57
+ }
53
58
  function parseVariantFormatString(input) {
54
59
  if (input.includes('{')) {
55
60
  if (!isBalanced(input)) throw new Error(`Your { and } are unbalanced.`);
@@ -147,7 +152,7 @@ function withIdentifiers(styles) {
147
152
  let [containsNonOnDemandableSelectors, candidates] = extractCandidates(node);
148
153
  // If this isn't "on-demandable", assign it a universal candidate to always include it.
149
154
  if (containsNonOnDemandableSelectors) {
150
- candidates.unshift('*');
155
+ candidates.unshift(sharedState.NOT_ON_DEMAND);
151
156
  }
152
157
  // However, it could be that it also contains "on-demandable" candidates.
153
158
  // E.g.: `span, .foo {}`, in that case it should still be possible to use
@@ -171,8 +176,8 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
171
176
  return (0, _prefixSelector).default(tailwindConfig.prefix, selector);
172
177
  }
173
178
  function prefixIdentifier(identifier, options) {
174
- if (identifier === '*') {
175
- return '*';
179
+ if (identifier === sharedState.NOT_ON_DEMAND) {
180
+ return sharedState.NOT_ON_DEMAND;
176
181
  }
177
182
  if (!options.respectPrefix) {
178
183
  return identifier;
@@ -736,9 +741,38 @@ function registerPlugins(plugins, context) {
736
741
  }
737
742
  }
738
743
  }
744
+ // A list of utilities that are used by certain Tailwind CSS utilities but
745
+ // that don't exist on their own. This will result in them "not existing" and
746
+ // sorting could be weird since you still require them in order to make the
747
+ // host utitlies work properly. (Thanks Biology)
748
+ let parasiteUtilities = new Set([
749
+ prefix(context, 'group'),
750
+ prefix(context, 'peer')
751
+ ]);
752
+ context.getClassOrder = function getClassOrder(classes) {
753
+ let sortedClassNames = new Map();
754
+ for (let [sort, rule] of (0, _generateRules).generateRules(new Set(classes), context)){
755
+ if (sortedClassNames.has(rule.raws.tailwind.candidate)) continue;
756
+ sortedClassNames.set(rule.raws.tailwind.candidate, sort);
757
+ }
758
+ return classes.map((className)=>{
759
+ var ref;
760
+ let order = (ref = sortedClassNames.get(className)) !== null && ref !== void 0 ? ref : null;
761
+ if (order === null && parasiteUtilities.has(className)) {
762
+ // This will make sure that it is at the very beginning of the
763
+ // `components` layer which technically means 'before any
764
+ // components'.
765
+ order = context.layerOrder.components;
766
+ }
767
+ return [
768
+ className,
769
+ order
770
+ ];
771
+ });
772
+ };
739
773
  // Generate a list of strings for autocompletion purposes, e.g.
740
774
  // ['uppercase', 'lowercase', ...]
741
- context.getClassList = function() {
775
+ context.getClassList = function getClassList() {
742
776
  let output = [];
743
777
  for (let util of classList){
744
778
  if (Array.isArray(util)) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.resolveDebug = resolveDebug;
6
- exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
6
+ exports.NOT_ON_DEMAND = exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
7
7
  const env = {
8
8
  NODE_ENV: process.env.NODE_ENV,
9
9
  DEBUG: resolveDebug(process.env.DEBUG)
@@ -15,6 +15,8 @@ const configContextMap = new Map();
15
15
  exports.configContextMap = configContextMap;
16
16
  const contextSourcesMap = new Map();
17
17
  exports.contextSourcesMap = contextSourcesMap;
18
+ const NOT_ON_DEMAND = new String('*');
19
+ exports.NOT_ON_DEMAND = NOT_ON_DEMAND;
18
20
  function resolveDebug(debug) {
19
21
  if (debug === undefined) {
20
22
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.0.19",
3
+ "version": "3.0.23",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -44,14 +44,14 @@
44
44
  "@swc/register": "^0.1.10",
45
45
  "autoprefixer": "^10.4.2",
46
46
  "cssnano": "^5.0.16",
47
- "esbuild": "^0.14.10",
47
+ "esbuild": "^0.14.21",
48
48
  "eslint": "^8.8.0",
49
49
  "eslint-config-prettier": "^8.3.0",
50
50
  "eslint-plugin-prettier": "^4.0.0",
51
- "jest": "^27.4.7",
52
- "jest-diff": "^27.4.6",
53
- "postcss": "^8.4.5",
51
+ "jest": "^27.5.1",
52
+ "jest-diff": "^27.5.1",
54
53
  "prettier": "^2.5.1",
54
+ "prettier-plugin-tailwindcss": "^0.1.7",
55
55
  "rimraf": "^3.0.0"
56
56
  },
57
57
  "peerDependencies": {
@@ -72,6 +72,7 @@
72
72
  "is-glob": "^4.0.3",
73
73
  "normalize-path": "^3.0.0",
74
74
  "object-hash": "^2.2.0",
75
+ "postcss": "^8.4.6",
75
76
  "postcss-js": "^4.0.0",
76
77
  "postcss-load-config": "^3.1.0",
77
78
  "postcss-nested": "5.0.6",
package/peers/index.js CHANGED
@@ -22,31 +22,31 @@ var require_picocolors = __commonJS({
22
22
  };
23
23
  var createColors = (enabled = isColorSupported) => ({
24
24
  isColorSupported: enabled,
25
- reset: enabled ? (s) => `${s}` : String,
26
- bold: enabled ? formatter("", "", "") : String,
27
- dim: enabled ? formatter("", "", "") : String,
28
- italic: enabled ? formatter("", "") : String,
29
- underline: enabled ? formatter("", "") : String,
30
- inverse: enabled ? formatter("", "") : String,
31
- hidden: enabled ? formatter("", "") : String,
32
- strikethrough: enabled ? formatter("", "") : String,
33
- black: enabled ? formatter("", "") : String,
34
- red: enabled ? formatter("", "") : String,
35
- green: enabled ? formatter("", "") : String,
36
- yellow: enabled ? formatter("", "") : String,
37
- blue: enabled ? formatter("", "") : String,
38
- magenta: enabled ? formatter("", "") : String,
39
- cyan: enabled ? formatter("", "") : String,
40
- white: enabled ? formatter("", "") : String,
41
- gray: enabled ? formatter("", "") : String,
42
- bgBlack: enabled ? formatter("", "") : String,
43
- bgRed: enabled ? formatter("", "") : String,
44
- bgGreen: enabled ? formatter("", "") : String,
45
- bgYellow: enabled ? formatter("", "") : String,
46
- bgBlue: enabled ? formatter("", "") : String,
47
- bgMagenta: enabled ? formatter("", "") : String,
48
- bgCyan: enabled ? formatter("", "") : String,
49
- bgWhite: enabled ? formatter("", "") : String
25
+ reset: enabled ? (s) => `\x1B[0m${s}\x1B[0m` : String,
26
+ bold: enabled ? formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
27
+ dim: enabled ? formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
28
+ italic: enabled ? formatter("\x1B[3m", "\x1B[23m") : String,
29
+ underline: enabled ? formatter("\x1B[4m", "\x1B[24m") : String,
30
+ inverse: enabled ? formatter("\x1B[7m", "\x1B[27m") : String,
31
+ hidden: enabled ? formatter("\x1B[8m", "\x1B[28m") : String,
32
+ strikethrough: enabled ? formatter("\x1B[9m", "\x1B[29m") : String,
33
+ black: enabled ? formatter("\x1B[30m", "\x1B[39m") : String,
34
+ red: enabled ? formatter("\x1B[31m", "\x1B[39m") : String,
35
+ green: enabled ? formatter("\x1B[32m", "\x1B[39m") : String,
36
+ yellow: enabled ? formatter("\x1B[33m", "\x1B[39m") : String,
37
+ blue: enabled ? formatter("\x1B[34m", "\x1B[39m") : String,
38
+ magenta: enabled ? formatter("\x1B[35m", "\x1B[39m") : String,
39
+ cyan: enabled ? formatter("\x1B[36m", "\x1B[39m") : String,
40
+ white: enabled ? formatter("\x1B[37m", "\x1B[39m") : String,
41
+ gray: enabled ? formatter("\x1B[90m", "\x1B[39m") : String,
42
+ bgBlack: enabled ? formatter("\x1B[40m", "\x1B[49m") : String,
43
+ bgRed: enabled ? formatter("\x1B[41m", "\x1B[49m") : String,
44
+ bgGreen: enabled ? formatter("\x1B[42m", "\x1B[49m") : String,
45
+ bgYellow: enabled ? formatter("\x1B[43m", "\x1B[49m") : String,
46
+ bgBlue: enabled ? formatter("\x1B[44m", "\x1B[49m") : String,
47
+ bgMagenta: enabled ? formatter("\x1B[45m", "\x1B[49m") : String,
48
+ bgCyan: enabled ? formatter("\x1B[46m", "\x1B[49m") : String,
49
+ bgWhite: enabled ? formatter("\x1B[47m", "\x1B[49m") : String
50
50
  });
51
51
  module2.exports = createColors();
52
52
  module2.exports.createColors = createColors;
@@ -4407,11 +4407,13 @@ var require_parser = __commonJS({
4407
4407
  if (brackets.length > 0)
4408
4408
  this.unclosedBracket(bracket);
4409
4409
  if (end && colon) {
4410
- while (tokens.length) {
4411
- token = tokens[tokens.length - 1][0];
4412
- if (token !== "space" && token !== "comment")
4413
- break;
4414
- this.tokenizer.back(tokens.pop());
4410
+ if (!customProperty) {
4411
+ while (tokens.length) {
4412
+ token = tokens[tokens.length - 1][0];
4413
+ if (token !== "space" && token !== "comment")
4414
+ break;
4415
+ this.tokenizer.back(tokens.pop());
4416
+ }
4415
4417
  }
4416
4418
  this.decl(tokens, customProperty);
4417
4419
  } else {
@@ -4467,7 +4469,14 @@ var require_parser = __commonJS({
4467
4469
  node.raws.before += node.prop[0];
4468
4470
  node.prop = node.prop.slice(1);
4469
4471
  }
4470
- let firstSpaces = this.spacesAndCommentsFromStart(tokens);
4472
+ let firstSpaces = [];
4473
+ let next;
4474
+ while (tokens.length) {
4475
+ next = tokens[0][0];
4476
+ if (next !== "space" && next !== "comment")
4477
+ break;
4478
+ firstSpaces.push(tokens.shift());
4479
+ }
4471
4480
  this.precheckMissedSemicolon(tokens);
4472
4481
  for (let i = tokens.length - 1; i >= 0; i--) {
4473
4482
  token = tokens[i];
@@ -4499,12 +4508,11 @@ var require_parser = __commonJS({
4499
4508
  }
4500
4509
  }
4501
4510
  let hasWord = tokens.some((i) => i[0] !== "space" && i[0] !== "comment");
4502
- this.raw(node, "value", tokens);
4503
4511
  if (hasWord) {
4504
- node.raws.between += firstSpaces;
4505
- } else {
4506
- node.value = firstSpaces + node.value;
4512
+ node.raws.between += firstSpaces.map((i) => i[1]).join("");
4513
+ firstSpaces = [];
4507
4514
  }
4515
+ this.raw(node, "value", firstSpaces.concat(tokens), customProperty);
4508
4516
  if (node.value.includes(":") && !customProperty) {
4509
4517
  this.checkMissedSemicolon(tokens);
4510
4518
  }
@@ -4635,28 +4643,25 @@ var require_parser = __commonJS({
4635
4643
  if (node.type !== "comment")
4636
4644
  this.semicolon = false;
4637
4645
  }
4638
- raw(node, prop, tokens) {
4646
+ raw(node, prop, tokens, customProperty) {
4639
4647
  let token, type;
4640
4648
  let length = tokens.length;
4641
4649
  let value = "";
4642
4650
  let clean = true;
4643
4651
  let next, prev;
4644
- let pattern = /^([#.|])?(\w)+/i;
4645
4652
  for (let i = 0; i < length; i += 1) {
4646
4653
  token = tokens[i];
4647
4654
  type = token[0];
4648
- if (type === "comment" && node.type === "rule") {
4655
+ if (type === "space" && i === length - 1 && !customProperty) {
4656
+ clean = false;
4657
+ } else if (type === "comment") {
4649
4658
  prev = tokens[i - 1];
4650
4659
  next = tokens[i + 1];
4651
- if (prev[0] !== "space" && next[0] !== "space" && pattern.test(prev[1]) && pattern.test(next[1])) {
4660
+ if (prev && next && prev[0] !== "space" && next[0] !== "space") {
4652
4661
  value += token[1];
4653
4662
  } else {
4654
4663
  clean = false;
4655
4664
  }
4656
- continue;
4657
- }
4658
- if (type === "comment" || type === "space" && i === length - 1) {
4659
- clean = false;
4660
4665
  } else {
4661
4666
  value += token[1];
4662
4667
  }
@@ -5356,8 +5361,12 @@ var require_no_work_result = __commonJS({
5356
5361
  } catch (error) {
5357
5362
  this.error = error;
5358
5363
  }
5359
- this._root = root;
5360
- return root;
5364
+ if (this.error) {
5365
+ throw this.error;
5366
+ } else {
5367
+ this._root = root;
5368
+ return root;
5369
+ }
5361
5370
  }
5362
5371
  get messages() {
5363
5372
  return [];
@@ -5408,7 +5417,7 @@ var require_processor = __commonJS({
5408
5417
  var Root = require_root();
5409
5418
  var Processor = class {
5410
5419
  constructor(plugins = []) {
5411
- this.version = "8.4.5";
5420
+ this.version = "8.4.6";
5412
5421
  this.plugins = this.normalize(plugins);
5413
5422
  }
5414
5423
  use(plugin) {
@@ -19734,7 +19743,7 @@ var require_parse_cst = __commonJS({
19734
19743
  str += "\b";
19735
19744
  break;
19736
19745
  case "e":
19737
- str += "";
19746
+ str += "\x1B";
19738
19747
  break;
19739
19748
  case "f":
19740
19749
  str += "\f";
@@ -70,7 +70,28 @@ export let variantPlugins = {
70
70
  'only-of-type',
71
71
 
72
72
  // State
73
- 'visited',
73
+ [
74
+ 'visited',
75
+ ({ container }) => {
76
+ let toRemove = ['--tw-text-opacity', '--tw-border-opacity', '--tw-bg-opacity']
77
+
78
+ container.walkDecls((decl) => {
79
+ if (toRemove.includes(decl.prop)) {
80
+ decl.remove()
81
+
82
+ return
83
+ }
84
+
85
+ for (const varName of toRemove) {
86
+ if (decl.value.includes(`/ var(${varName})`)) {
87
+ decl.value = decl.value.replace(`/ var(${varName})`, '')
88
+ }
89
+ }
90
+ })
91
+
92
+ return ':visited'
93
+ },
94
+ ],
74
95
  'target',
75
96
  ['open', '[open]'],
76
97
 
@@ -100,15 +121,27 @@ export let variantPlugins = {
100
121
  ].map((variant) => (Array.isArray(variant) ? variant : [variant, `:${variant}`]))
101
122
 
102
123
  for (let [variantName, state] of pseudoVariants) {
103
- addVariant(variantName, `&${state}`)
124
+ addVariant(variantName, (ctx) => {
125
+ let result = typeof state === 'function' ? state(ctx) : state
126
+
127
+ return `&${result}`
128
+ })
104
129
  }
105
130
 
106
131
  for (let [variantName, state] of pseudoVariants) {
107
- addVariant(`group-${variantName}`, `:merge(.group)${state} &`)
132
+ addVariant(`group-${variantName}`, (ctx) => {
133
+ let result = typeof state === 'function' ? state(ctx) : state
134
+
135
+ return `:merge(.group)${result} &`
136
+ })
108
137
  }
109
138
 
110
139
  for (let [variantName, state] of pseudoVariants) {
111
- addVariant(`peer-${variantName}`, `:merge(.peer)${state} ~ &`)
140
+ addVariant(`peer-${variantName}`, (ctx) => {
141
+ let result = typeof state === 'function' ? state(ctx) : state
142
+
143
+ return `:merge(.peer)${result} ~ &`
144
+ })
112
145
  }
113
146
  },
114
147
 
@@ -8,6 +8,8 @@ const PATTERNS = [
8
8
  /([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source, // bg-[url("...")]
9
9
  /([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source, // bg-[url('...'),url('...')]
10
10
  /([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source, // bg-[url("..."),url("...")]
11
+ /([^<>"'`\s]*\[[^<>"'`\s]*\('[^"`\s]*'\)+\])/.source, // h-[calc(100%-theme('spacing.1'))]
12
+ /([^<>"'`\s]*\[[^<>"'`\s]*\("[^'`\s]*"\)+\])/.source, // h-[calc(100%-theme("spacing.1"))]
11
13
  /([^<>"'`\s]*\['[^"'`\s]*'\])/.source, // `content-['hello']` but not `content-['hello']']`
12
14
  /([^<>"'`\s]*\["[^"'`\s]*"\])/.source, // `content-["hello"]` but not `content-["hello"]"]`
13
15
  /([^<>"'`\s]*\[[^<>"'`\s]*:[^\]\s]*\])/.source, // `[attr:value]`
@@ -161,12 +161,12 @@ function processApply(root, context) {
161
161
  }
162
162
 
163
163
  for (let applyCandidate of applyCandidates) {
164
- if (!applyClassCache.has(applyCandidate)) {
165
- if (applyCandidate === prefix(context, 'group')) {
166
- // TODO: Link to specific documentation page with error code.
167
- throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`)
168
- }
164
+ if ([prefix(context, 'group'), prefix(context, 'peer')].includes(applyCandidate)) {
165
+ // TODO: Link to specific documentation page with error code.
166
+ throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`)
167
+ }
169
168
 
169
+ if (!applyClassCache.has(applyCandidate)) {
170
170
  throw apply.error(
171
171
  `The \`${applyCandidate}\` class does not exist. If \`${applyCandidate}\` is a custom class, make sure it is defined within a \`@layer\` directive.`
172
172
  )
@@ -158,7 +158,7 @@ export default function expandTailwindAtRules(context) {
158
158
  // ---
159
159
 
160
160
  // Find potential rules in changed files
161
- let candidates = new Set(['*'])
161
+ let candidates = new Set([sharedState.NOT_ON_DEMAND])
162
162
  let seen = new Set()
163
163
 
164
164
  env.DEBUG && console.time('Reading changed files')
@@ -5,6 +5,7 @@ import isPlainObject from '../util/isPlainObject'
5
5
  import prefixSelector from '../util/prefixSelector'
6
6
  import { updateAllClasses } from '../util/pluginUtils'
7
7
  import log from '../util/log'
8
+ import * as sharedState from './sharedState'
8
9
  import { formatVariantSelector, finalizeSelector } from '../util/formatVariantSelector'
9
10
  import { asClass } from '../util/nameClass'
10
11
  import { normalize } from '../util/dataTypes'
@@ -234,7 +235,7 @@ function applyVariant(variant, matches, context) {
234
235
  // For example:
235
236
  // .sm:underline {} is a variant of something in the utilities layer
236
237
  // .sm:container {} is a variant of the container component
237
- clone.nodes[0].raws.tailwind = { parentLayer: meta.layer }
238
+ clone.nodes[0].raws.tailwind = { ...clone.nodes[0].raws.tailwind, parentLayer: meta.layer }
238
239
 
239
240
  let withOffset = [
240
241
  {
@@ -382,12 +383,16 @@ function* resolveMatchedPlugins(classCandidate, context) {
382
383
  }
383
384
 
384
385
  function splitWithSeparator(input, separator) {
386
+ if (input === sharedState.NOT_ON_DEMAND) {
387
+ return [sharedState.NOT_ON_DEMAND]
388
+ }
389
+
385
390
  return input.split(new RegExp(`\\${separator}(?![^[]*\\])`, 'g'))
386
391
  }
387
392
 
388
393
  function* recordCandidates(matches, classCandidate) {
389
394
  for (const match of matches) {
390
- match[1].raws.tailwind = { classCandidate }
395
+ match[1].raws.tailwind = { ...match[1].raws.tailwind, classCandidate }
391
396
 
392
397
  yield match
393
398
  }
@@ -517,6 +522,8 @@ function* resolveMatches(candidate, context) {
517
522
  }
518
523
 
519
524
  for (let match of matches) {
525
+ match[1].raws.tailwind = { ...match[1].raws.tailwind, candidate }
526
+
520
527
  // Apply final format selector
521
528
  if (match[0].collectedFormats) {
522
529
  let finalFormat = formatVariantSelector('&', ...match[0].collectedFormats)
@@ -19,6 +19,12 @@ import { toPath } from '../util/toPath'
19
19
  import log from '../util/log'
20
20
  import negateValue from '../util/negateValue'
21
21
  import isValidArbitraryValue from '../util/isValidArbitraryValue'
22
+ import { generateRules } from './generateRules'
23
+
24
+ function prefix(context, selector) {
25
+ let prefix = context.tailwindConfig.prefix
26
+ return typeof prefix === 'function' ? prefix(selector) : prefix + selector
27
+ }
22
28
 
23
29
  function parseVariantFormatString(input) {
24
30
  if (input.includes('{')) {
@@ -132,7 +138,7 @@ function withIdentifiers(styles) {
132
138
 
133
139
  // If this isn't "on-demandable", assign it a universal candidate to always include it.
134
140
  if (containsNonOnDemandableSelectors) {
135
- candidates.unshift('*')
141
+ candidates.unshift(sharedState.NOT_ON_DEMAND)
136
142
  }
137
143
 
138
144
  // However, it could be that it also contains "on-demandable" candidates.
@@ -157,8 +163,8 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
157
163
  }
158
164
 
159
165
  function prefixIdentifier(identifier, options) {
160
- if (identifier === '*') {
161
- return '*'
166
+ if (identifier === sharedState.NOT_ON_DEMAND) {
167
+ return sharedState.NOT_ON_DEMAND
162
168
  }
163
169
 
164
170
  if (!options.respectPrefix) {
@@ -733,9 +739,35 @@ function registerPlugins(plugins, context) {
733
739
  }
734
740
  }
735
741
 
742
+ // A list of utilities that are used by certain Tailwind CSS utilities but
743
+ // that don't exist on their own. This will result in them "not existing" and
744
+ // sorting could be weird since you still require them in order to make the
745
+ // host utitlies work properly. (Thanks Biology)
746
+ let parasiteUtilities = new Set([prefix(context, 'group'), prefix(context, 'peer')])
747
+ context.getClassOrder = function getClassOrder(classes) {
748
+ let sortedClassNames = new Map()
749
+ for (let [sort, rule] of generateRules(new Set(classes), context)) {
750
+ if (sortedClassNames.has(rule.raws.tailwind.candidate)) continue
751
+ sortedClassNames.set(rule.raws.tailwind.candidate, sort)
752
+ }
753
+
754
+ return classes.map((className) => {
755
+ let order = sortedClassNames.get(className) ?? null
756
+
757
+ if (order === null && parasiteUtilities.has(className)) {
758
+ // This will make sure that it is at the very beginning of the
759
+ // `components` layer which technically means 'before any
760
+ // components'.
761
+ order = context.layerOrder.components
762
+ }
763
+
764
+ return [className, order]
765
+ })
766
+ }
767
+
736
768
  // Generate a list of strings for autocompletion purposes, e.g.
737
769
  // ['uppercase', 'lowercase', ...]
738
- context.getClassList = function () {
770
+ context.getClassList = function getClassList() {
739
771
  let output = []
740
772
 
741
773
  for (let util of classList) {
@@ -5,6 +5,7 @@ export const env = {
5
5
  export const contextMap = new Map()
6
6
  export const configContextMap = new Map()
7
7
  export const contextSourcesMap = new Map()
8
+ export const NOT_ON_DEMAND = new String('*')
8
9
 
9
10
  export function resolveDebug(debug) {
10
11
  if (debug === undefined) {