tailwindcss 3.0.21 → 3.0.24

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 (89) hide show
  1. package/CHANGELOG.md +45 -2
  2. package/lib/cli-peer-dependencies.js +3 -3
  3. package/lib/cli.js +183 -161
  4. package/lib/constants.js +8 -8
  5. package/lib/corePlugins.js +1597 -1518
  6. package/lib/featureFlags.js +9 -9
  7. package/lib/index.js +19 -6
  8. package/lib/lib/cacheInvalidation.js +69 -0
  9. package/lib/lib/collapseAdjacentRules.js +26 -13
  10. package/lib/lib/collapseDuplicateDeclarations.js +1 -1
  11. package/lib/lib/defaultExtractor.js +8 -6
  12. package/lib/lib/detectNesting.js +9 -9
  13. package/lib/lib/evaluateTailwindFunctions.js +16 -16
  14. package/lib/lib/expandApplyAtRules.js +180 -27
  15. package/lib/lib/expandTailwindAtRules.js +132 -122
  16. package/lib/lib/generateRules.js +117 -72
  17. package/lib/lib/getModuleDependencies.js +14 -14
  18. package/lib/lib/normalizeTailwindDirectives.js +35 -35
  19. package/lib/lib/partitionApplyAtRules.js +7 -7
  20. package/lib/lib/resolveDefaultsAtRules.js +81 -77
  21. package/lib/lib/setupContextUtils.js +83 -98
  22. package/lib/lib/setupTrackingContext.js +57 -57
  23. package/lib/lib/sharedState.js +11 -7
  24. package/lib/lib/substituteScreenAtRules.js +2 -2
  25. package/lib/postcss-plugins/nesting/README.md +2 -2
  26. package/lib/postcss-plugins/nesting/index.js +1 -1
  27. package/lib/postcss-plugins/nesting/plugin.js +41 -9
  28. package/lib/processTailwindFeatures.js +7 -7
  29. package/lib/public/colors.js +241 -241
  30. package/lib/public/resolve-config.js +5 -5
  31. package/lib/util/buildMediaQuery.js +2 -2
  32. package/lib/util/cloneDeep.js +1 -1
  33. package/lib/util/cloneNodes.js +12 -1
  34. package/lib/util/color.js +21 -20
  35. package/lib/util/createUtilityPlugin.js +6 -6
  36. package/lib/util/dataTypes.js +77 -75
  37. package/lib/util/escapeClassName.js +5 -5
  38. package/lib/util/escapeCommas.js +1 -1
  39. package/lib/util/flattenColorPalette.js +2 -2
  40. package/lib/util/formatVariantSelector.js +19 -19
  41. package/lib/util/getAllConfigs.js +5 -5
  42. package/lib/util/hashConfig.js +5 -5
  43. package/lib/util/isKeyframeRule.js +1 -1
  44. package/lib/util/isPlainObject.js +1 -1
  45. package/lib/util/isValidArbitraryValue.js +27 -27
  46. package/lib/util/log.js +8 -8
  47. package/lib/util/nameClass.js +7 -7
  48. package/lib/util/negateValue.js +4 -4
  49. package/lib/util/normalizeConfig.js +39 -39
  50. package/lib/util/normalizeScreens.js +4 -4
  51. package/lib/util/parseAnimationValue.js +56 -56
  52. package/lib/util/parseBoxShadowValue.js +60 -20
  53. package/lib/util/parseDependency.js +32 -32
  54. package/lib/util/parseObjectStyles.js +6 -6
  55. package/lib/util/pluginUtils.js +9 -9
  56. package/lib/util/prefixSelector.js +1 -1
  57. package/lib/util/resolveConfig.js +28 -28
  58. package/lib/util/resolveConfigPath.js +16 -16
  59. package/lib/util/responsive.js +6 -6
  60. package/lib/util/toColorValue.js +1 -1
  61. package/lib/util/toPath.js +2 -2
  62. package/lib/util/transformThemeValue.js +27 -27
  63. package/lib/util/withAlphaVariable.js +19 -19
  64. package/package.json +26 -25
  65. package/peers/index.js +4803 -4857
  66. package/scripts/generate-types.js +52 -0
  67. package/src/cli.js +41 -11
  68. package/src/corePlugins.js +104 -9
  69. package/src/featureFlags.js +2 -2
  70. package/src/index.js +17 -1
  71. package/src/lib/cacheInvalidation.js +52 -0
  72. package/src/lib/collapseAdjacentRules.js +16 -1
  73. package/src/lib/defaultExtractor.js +6 -4
  74. package/src/lib/expandApplyAtRules.js +179 -6
  75. package/src/lib/expandTailwindAtRules.js +26 -6
  76. package/src/lib/generateRules.js +73 -46
  77. package/src/lib/resolveDefaultsAtRules.js +6 -2
  78. package/src/lib/setupContextUtils.js +39 -48
  79. package/src/lib/setupTrackingContext.js +3 -3
  80. package/src/lib/sharedState.js +2 -0
  81. package/src/postcss-plugins/nesting/README.md +2 -2
  82. package/src/postcss-plugins/nesting/plugin.js +36 -0
  83. package/src/util/cloneNodes.js +14 -1
  84. package/src/util/color.js +7 -5
  85. package/src/util/dataTypes.js +3 -1
  86. package/src/util/log.js +7 -7
  87. package/src/util/parseBoxShadowValue.js +50 -2
  88. package/src/util/resolveConfig.js +32 -0
  89. package/stubs/defaultConfig.stub.js +5 -0
package/lib/util/color.js CHANGED
@@ -12,48 +12,49 @@ function _interopRequireDefault(obj) {
12
12
  }
13
13
  let HEX = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
14
14
  let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
15
- let VALUE = `(?:\\d+|\\d*\\.\\d+)%?`;
16
- let SEP = `(?:\\s*,\\s*|\\s+)`;
17
- let ALPHA_SEP = `\\s*[,/]\\s*`;
18
- let RGB = new RegExp(`^rgba?\\(\\s*(${VALUE})${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`);
19
- let HSL = new RegExp(`^hsla?\\(\\s*((?:${VALUE})(?:deg|rad|grad|turn)?)${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`);
15
+ let VALUE = /(?:\d+|\d*\.\d+)%?/;
16
+ let SEP = /(?:\s*,\s*|\s+)/;
17
+ let ALPHA_SEP = /\s*[,/]\s*/;
18
+ let CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)\)/;
19
+ let RGB = new RegExp(`^rgba?\\(\\s*(${VALUE.source}|${CUSTOM_PROPERTY.source})${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source})${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source})(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`);
20
+ let HSL = new RegExp(`^hsla?\\(\\s*((?:${VALUE.source})(?:deg|rad|grad|turn)?|${CUSTOM_PROPERTY.source})${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source})${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source})(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`);
20
21
  function parseColor(value) {
21
- if (typeof value !== 'string') {
22
+ if (typeof value !== "string") {
22
23
  return null;
23
24
  }
24
25
  value = value.trim();
25
- if (value === 'transparent') {
26
+ if (value === "transparent") {
26
27
  return {
27
- mode: 'rgb',
28
+ mode: "rgb",
28
29
  color: [
29
- '0',
30
- '0',
31
- '0'
30
+ "0",
31
+ "0",
32
+ "0"
32
33
  ],
33
- alpha: '0'
34
+ alpha: "0"
34
35
  };
35
36
  }
36
37
  if (value in _colorName.default) {
37
38
  return {
38
- mode: 'rgb',
39
+ mode: "rgb",
39
40
  color: _colorName.default[value].map((v)=>v.toString()
40
41
  )
41
42
  };
42
43
  }
43
44
  let hex = value.replace(SHORT_HEX, (_, r, g, b, a)=>[
44
- '#',
45
+ "#",
45
46
  r,
46
47
  r,
47
48
  g,
48
49
  g,
49
50
  b,
50
51
  b,
51
- a ? a + a : ''
52
- ].join('')
52
+ a ? a + a : ""
53
+ ].join("")
53
54
  ).match(HEX);
54
55
  if (hex !== null) {
55
56
  return {
56
- mode: 'rgb',
57
+ mode: "rgb",
57
58
  color: [
58
59
  parseInt(hex[1], 16),
59
60
  parseInt(hex[2], 16),
@@ -67,7 +68,7 @@ function parseColor(value) {
67
68
  if (rgbMatch !== null) {
68
69
  var ref, ref1;
69
70
  return {
70
- mode: 'rgb',
71
+ mode: "rgb",
71
72
  color: [
72
73
  rgbMatch[1],
73
74
  rgbMatch[2],
@@ -81,7 +82,7 @@ function parseColor(value) {
81
82
  if (hslMatch !== null) {
82
83
  var ref2, ref3;
83
84
  return {
84
- mode: 'hsl',
85
+ mode: "hsl",
85
86
  color: [
86
87
  hslMatch[1],
87
88
  hslMatch[2],
@@ -95,5 +96,5 @@ function parseColor(value) {
95
96
  }
96
97
  function formatColor({ mode , color , alpha }) {
97
98
  let hasAlpha = alpha !== undefined;
98
- return `${mode}(${color.join(' ')}${hasAlpha ? ` / ${alpha}` : ''})`;
99
+ return `${mode}(${color.join(" ")}${hasAlpha ? ` / ${alpha}` : ""})`;
99
100
  }
@@ -4,11 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = createUtilityPlugin;
6
6
  var _transformThemeValue = _interopRequireDefault(require("./transformThemeValue"));
7
- function _interopRequireDefault(obj) {
8
- return obj && obj.__esModule ? obj : {
9
- default: obj
10
- };
11
- }
12
7
  function createUtilityPlugin(themeKey, utilityVariations = [
13
8
  [
14
9
  themeKey,
@@ -41,9 +36,14 @@ function createUtilityPlugin(themeKey, utilityVariations = [
41
36
  });
42
37
  }, {}), {
43
38
  ...options,
44
- values: filterDefault ? Object.fromEntries(Object.entries((ref = theme(themeKey)) !== null && ref !== void 0 ? ref : {}).filter(([modifier])=>modifier !== 'DEFAULT'
39
+ values: filterDefault ? Object.fromEntries(Object.entries((ref = theme(themeKey)) !== null && ref !== void 0 ? ref : {}).filter(([modifier])=>modifier !== "DEFAULT"
45
40
  )) : theme(themeKey)
46
41
  });
47
42
  }
48
43
  };
49
44
  }
45
+ function _interopRequireDefault(obj) {
46
+ return obj && obj.__esModule ? obj : {
47
+ default: obj
48
+ };
49
+ }
@@ -20,10 +20,10 @@ exports.relativeSize = relativeSize;
20
20
  var _color = require("./color");
21
21
  var _parseBoxShadowValue = require("./parseBoxShadowValue");
22
22
  let cssFunctions = [
23
- 'min',
24
- 'max',
25
- 'clamp',
26
- 'calc'
23
+ "min",
24
+ "max",
25
+ "clamp",
26
+ "calc"
27
27
  ];
28
28
  // Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types
29
29
  let COMMA = /,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
@@ -32,65 +32,67 @@ let UNDERSCORE = /_(?![^(]*\))/g // Underscore separator that is not located bet
32
32
  ;
33
33
  function normalize(value, isRoot = true) {
34
34
  // Keep raw strings if it starts with `url(`
35
- if (value.includes('url(')) {
35
+ if (value.includes("url(")) {
36
36
  return value.split(/(url\(.*?\))/g).filter(Boolean).map((part)=>{
37
37
  if (/^url\(.*?\)$/.test(part)) {
38
38
  return part;
39
39
  }
40
40
  return normalize(part, false);
41
- }).join('');
41
+ }).join("");
42
42
  }
43
43
  // Convert `_` to ` `, except for escaped underscores `\_`
44
- value = value.replace(/([^\\])_+/g, (fullMatch, characterBefore)=>characterBefore + ' '.repeat(fullMatch.length - 1)
45
- ).replace(/^_/g, ' ').replace(/\\_/g, '_');
44
+ value = value.replace(/([^\\])_+/g, (fullMatch, characterBefore)=>characterBefore + " ".repeat(fullMatch.length - 1)
45
+ ).replace(/^_/g, " ").replace(/\\_/g, "_");
46
46
  // Remove leftover whitespace
47
47
  if (isRoot) {
48
48
  value = value.trim();
49
49
  }
50
50
  // Add spaces around operators inside calc() that do not follow an operator
51
51
  // or '('.
52
- return value.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, '$1 $2 ');
52
+ return value.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
53
53
  }
54
54
  function url(value) {
55
- return value.startsWith('url(');
55
+ return value.startsWith("url(");
56
56
  }
57
57
  function number(value) {
58
58
  return !isNaN(Number(value)) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?`).test(value)
59
59
  );
60
60
  }
61
61
  function percentage(value) {
62
- return /%$/g.test(value) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?%`).test(value)
63
- );
62
+ return value.split(UNDERSCORE).every((part)=>{
63
+ return /%$/g.test(part) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?%`).test(part)
64
+ );
65
+ });
64
66
  }
65
67
  let lengthUnits = [
66
- 'cm',
67
- 'mm',
68
- 'Q',
69
- 'in',
70
- 'pc',
71
- 'pt',
72
- 'px',
73
- 'em',
74
- 'ex',
75
- 'ch',
76
- 'rem',
77
- 'lh',
78
- 'vw',
79
- 'vh',
80
- 'vmin',
81
- 'vmax',
68
+ "cm",
69
+ "mm",
70
+ "Q",
71
+ "in",
72
+ "pc",
73
+ "pt",
74
+ "px",
75
+ "em",
76
+ "ex",
77
+ "ch",
78
+ "rem",
79
+ "lh",
80
+ "vw",
81
+ "vh",
82
+ "vmin",
83
+ "vmax",
82
84
  ];
83
- let lengthUnitsPattern = `(?:${lengthUnits.join('|')})`;
85
+ let lengthUnitsPattern = `(?:${lengthUnits.join("|")})`;
84
86
  function length(value) {
85
87
  return value.split(UNDERSCORE).every((part)=>{
86
- return part === '0' || new RegExp(`${lengthUnitsPattern}$`).test(part) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?${lengthUnitsPattern}`).test(part)
88
+ return part === "0" || new RegExp(`${lengthUnitsPattern}$`).test(part) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?${lengthUnitsPattern}`).test(part)
87
89
  );
88
90
  });
89
91
  }
90
92
  let lineWidths = new Set([
91
- 'thin',
92
- 'medium',
93
- 'thick'
93
+ "thin",
94
+ "medium",
95
+ "thick"
94
96
  ]);
95
97
  function lineWidth(value) {
96
98
  return lineWidths.has(value);
@@ -108,7 +110,7 @@ function color(value) {
108
110
  let colors = 0;
109
111
  let result = value.split(UNDERSCORE).every((part)=>{
110
112
  part = normalize(part);
111
- if (part.startsWith('var(')) return true;
113
+ if (part.startsWith("var(")) return true;
112
114
  if ((0, _color).parseColor(part) !== null) return colors++, true;
113
115
  return false;
114
116
  });
@@ -119,12 +121,12 @@ function image(value) {
119
121
  let images = 0;
120
122
  let result = value.split(COMMA).every((part)=>{
121
123
  part = normalize(part);
122
- if (part.startsWith('var(')) return true;
124
+ if (part.startsWith("var(")) return true;
123
125
  if (url(part) || gradient(part) || [
124
- 'element(',
125
- 'image(',
126
- 'cross-fade(',
127
- 'image-set('
126
+ "element(",
127
+ "image(",
128
+ "cross-fade(",
129
+ "image-set("
128
130
  ].some((fn)=>part.startsWith(fn)
129
131
  )) {
130
132
  images++;
@@ -136,11 +138,11 @@ function image(value) {
136
138
  return images > 0;
137
139
  }
138
140
  let gradientTypes = new Set([
139
- 'linear-gradient',
140
- 'radial-gradient',
141
- 'repeating-linear-gradient',
142
- 'repeating-radial-gradient',
143
- 'conic-gradient',
141
+ "linear-gradient",
142
+ "radial-gradient",
143
+ "repeating-linear-gradient",
144
+ "repeating-radial-gradient",
145
+ "conic-gradient",
144
146
  ]);
145
147
  function gradient(value) {
146
148
  value = normalize(value);
@@ -152,17 +154,17 @@ function gradient(value) {
152
154
  return false;
153
155
  }
154
156
  let validPositions = new Set([
155
- 'center',
156
- 'top',
157
- 'right',
158
- 'bottom',
159
- 'left'
157
+ "center",
158
+ "top",
159
+ "right",
160
+ "bottom",
161
+ "left"
160
162
  ]);
161
163
  function position(value) {
162
164
  let positions = 0;
163
165
  let result = value.split(UNDERSCORE).every((part)=>{
164
166
  part = normalize(part);
165
- if (part.startsWith('var(')) return true;
167
+ if (part.startsWith("var(")) return true;
166
168
  if (validPositions.has(part) || length(part) || percentage(part)) {
167
169
  positions++;
168
170
  return true;
@@ -176,9 +178,9 @@ function familyName(value) {
176
178
  let fonts = 0;
177
179
  let result = value.split(COMMA).every((part)=>{
178
180
  part = normalize(part);
179
- if (part.startsWith('var(')) return true;
181
+ if (part.startsWith("var(")) return true;
180
182
  // If it contains spaces, then it should be quoted
181
- if (part.includes(' ')) {
183
+ if (part.includes(" ")) {
182
184
  if (!/(['"])([^"']+)\1/g.test(part)) {
183
185
  return false;
184
186
  }
@@ -194,39 +196,39 @@ function familyName(value) {
194
196
  return fonts > 0;
195
197
  }
196
198
  let genericNames = new Set([
197
- 'serif',
198
- 'sans-serif',
199
- 'monospace',
200
- 'cursive',
201
- 'fantasy',
202
- 'system-ui',
203
- 'ui-serif',
204
- 'ui-sans-serif',
205
- 'ui-monospace',
206
- 'ui-rounded',
207
- 'math',
208
- 'emoji',
209
- 'fangsong',
199
+ "serif",
200
+ "sans-serif",
201
+ "monospace",
202
+ "cursive",
203
+ "fantasy",
204
+ "system-ui",
205
+ "ui-serif",
206
+ "ui-sans-serif",
207
+ "ui-monospace",
208
+ "ui-rounded",
209
+ "math",
210
+ "emoji",
211
+ "fangsong",
210
212
  ]);
211
213
  function genericName(value) {
212
214
  return genericNames.has(value);
213
215
  }
214
216
  let absoluteSizes = new Set([
215
- 'xx-small',
216
- 'x-small',
217
- 'small',
218
- 'medium',
219
- 'large',
220
- 'x-large',
221
- 'x-large',
222
- 'xxx-large',
217
+ "xx-small",
218
+ "x-small",
219
+ "small",
220
+ "medium",
221
+ "large",
222
+ "x-large",
223
+ "x-large",
224
+ "xxx-large",
223
225
  ]);
224
226
  function absoluteSize(value) {
225
227
  return absoluteSizes.has(value);
226
228
  }
227
229
  let relativeSizes = new Set([
228
- 'larger',
229
- 'smaller'
230
+ "larger",
231
+ "smaller"
230
232
  ]);
231
233
  function relativeSize(value) {
232
234
  return relativeSizes.has(value);
@@ -5,11 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  exports.default = escapeClassName;
6
6
  var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
7
7
  var _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
8
- function _interopRequireDefault(obj) {
9
- return obj && obj.__esModule ? obj : {
10
- default: obj
11
- };
12
- }
13
8
  function escapeClassName(className) {
14
9
  var ref;
15
10
  let node = _postcssSelectorParser.default.className();
@@ -17,3 +12,8 @@ function escapeClassName(className) {
17
12
  var ref1;
18
13
  return (0, _escapeCommas).default((ref1 = node === null || node === void 0 ? void 0 : (ref = node.raws) === null || ref === void 0 ? void 0 : ref.value) !== null && ref1 !== void 0 ? ref1 : node.value);
19
14
  }
15
+ function _interopRequireDefault(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = escapeCommas;
6
6
  function escapeCommas(className) {
7
- return className.replace(/\\,/g, '\\2c ');
7
+ return className.replace(/\\,/g, "\\2c ");
8
8
  }
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.default = void 0;
6
- const flattenColorPalette = (colors)=>Object.assign({}, ...Object.entries(colors !== null && colors !== void 0 ? colors : {}).flatMap(([color, values])=>typeof values == 'object' ? Object.entries(flattenColorPalette(values)).map(([number, hex])=>({
7
- [color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex
6
+ const flattenColorPalette = (colors)=>Object.assign({}, ...Object.entries(colors !== null && colors !== void 0 ? colors : {}).flatMap(([color, values])=>typeof values == "object" ? Object.entries(flattenColorPalette(values)).map(([number, hex])=>({
7
+ [color + (number === "DEFAULT" ? "" : `-${number}`)]: hex
8
8
  })
9
9
  ) : [
10
10
  {
@@ -14,8 +14,8 @@ function _interopRequireDefault(obj) {
14
14
  default: obj
15
15
  };
16
16
  }
17
- let MERGE = ':merge';
18
- let PARENT = '&';
17
+ let MERGE = ":merge";
18
+ let PARENT = "&";
19
19
  let selectorFunctions = new Set([
20
20
  MERGE
21
21
  ]);
@@ -28,7 +28,7 @@ function formatVariantSelector(current, ...others) {
28
28
  if (existingValue !== null) {
29
29
  let existingTarget = `${MERGE}(${incomingValue})`;
30
30
  let splitIdx = other.indexOf(existingTarget);
31
- let addition = other.slice(splitIdx + existingTarget.length).split(' ')[0];
31
+ let addition = other.slice(splitIdx + existingTarget.length).split(" ")[0];
32
32
  current = current.replace(existingTarget, existingTarget + addition);
33
33
  continue;
34
34
  }
@@ -40,7 +40,7 @@ function formatVariantSelector(current, ...others) {
40
40
  function finalizeSelector(format, { selector: selector1 , candidate , context }) {
41
41
  var ref, ref1;
42
42
  var ref2;
43
- let separator = (ref2 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref2 !== void 0 ? ref2 : ':';
43
+ let separator = (ref2 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref2 !== void 0 ? ref2 : ":";
44
44
  // Split by the separator, but ignore the separator inside square brackets:
45
45
  //
46
46
  // E.g.: dark:lg:hover:[paint-order:markers]
@@ -120,14 +120,14 @@ function finalizeSelector(format, { selector: selector1 , candidate , context }
120
120
  // this distinction was not present in older versions of the W3C spec, most
121
121
  // browsers support both syntaxes for the original pseudo-elements.
122
122
  let pseudoElementsBC = [
123
- ':before',
124
- ':after',
125
- ':first-line',
126
- ':first-letter'
123
+ ":before",
124
+ ":after",
125
+ ":first-line",
126
+ ":first-letter"
127
127
  ];
128
128
  // These pseudo-elements _can_ be combined with other pseudo selectors AND the order does matter.
129
129
  let pseudoElementExceptions = [
130
- '::file-selector-button'
130
+ "::file-selector-button"
131
131
  ];
132
132
  // This will make sure to move pseudo's to the correct spot (the end for
133
133
  // pseudo elements) because otherwise the selector will never work
@@ -142,42 +142,42 @@ let pseudoElementExceptions = [
142
142
  function sortSelector(a, z) {
143
143
  // Both nodes are non-pseudo's so we can safely ignore them and keep
144
144
  // them in the same order.
145
- if (a.type !== 'pseudo' && z.type !== 'pseudo') {
145
+ if (a.type !== "pseudo" && z.type !== "pseudo") {
146
146
  return 0;
147
147
  }
148
148
  // If one of them is a combinator, we need to keep it in the same order
149
149
  // because that means it will start a new "section" in the selector.
150
- if (a.type === 'combinator' ^ z.type === 'combinator') {
150
+ if (a.type === "combinator" ^ z.type === "combinator") {
151
151
  return 0;
152
152
  }
153
153
  // One of the items is a pseudo and the other one isn't. Let's move
154
154
  // the pseudo to the right.
155
- if (a.type === 'pseudo' ^ z.type === 'pseudo') {
156
- return (a.type === 'pseudo') - (z.type === 'pseudo');
155
+ if (a.type === "pseudo" ^ z.type === "pseudo") {
156
+ return (a.type === "pseudo") - (z.type === "pseudo");
157
157
  }
158
158
  // Both are pseudo's, move the pseudo elements (except for
159
159
  // ::file-selector-button) to the right.
160
160
  return isPseudoElement(a) - isPseudoElement(z);
161
161
  }
162
162
  function isPseudoElement(node) {
163
- if (node.type !== 'pseudo') return false;
163
+ if (node.type !== "pseudo") return false;
164
164
  if (pseudoElementExceptions.includes(node.value)) return false;
165
- return node.value.startsWith('::') || pseudoElementsBC.includes(node.value);
165
+ return node.value.startsWith("::") || pseudoElementsBC.includes(node.value);
166
166
  }
167
167
  function resolveFunctionArgument(haystack, needle, arg) {
168
168
  let startIdx = haystack.indexOf(arg ? `${needle}(${arg})` : needle);
169
169
  if (startIdx === -1) return null;
170
170
  // Start inside the `(`
171
171
  startIdx += needle.length + 1;
172
- let target = '';
172
+ let target = "";
173
173
  let count = 0;
174
174
  for (let char of haystack.slice(startIdx)){
175
- if (char !== '(' && char !== ')') {
175
+ if (char !== "(" && char !== ")") {
176
176
  target += char;
177
- } else if (char === '(') {
177
+ } else if (char === "(") {
178
178
  target += char;
179
179
  count++;
180
- } else if (char === ')') {
180
+ } else if (char === ")") {
181
181
  if (--count < 0) break; // unbalanced
182
182
  target += char;
183
183
  }
@@ -5,11 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  exports.default = getAllConfigs;
6
6
  var _defaultConfigStubJs = _interopRequireDefault(require("../../stubs/defaultConfig.stub.js"));
7
7
  var _featureFlags = require("../featureFlags");
8
- function _interopRequireDefault(obj) {
9
- return obj && obj.__esModule ? obj : {
10
- default: obj
11
- };
12
- }
13
8
  function getAllConfigs(config) {
14
9
  var ref;
15
10
  const configs = ((ref = config === null || config === void 0 ? void 0 : config.presets) !== null && ref !== void 0 ? ref : [
@@ -27,3 +22,8 @@ function getAllConfigs(config) {
27
22
  ...configs
28
23
  ];
29
24
  }
25
+ function _interopRequireDefault(obj) {
26
+ return obj && obj.__esModule ? obj : {
27
+ default: obj
28
+ };
29
+ }
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = hashConfig;
6
6
  var _objectHash = _interopRequireDefault(require("object-hash"));
7
- function _interopRequireDefault(obj) {
8
- return obj && obj.__esModule ? obj : {
9
- default: obj
10
- };
11
- }
12
7
  function hashConfig(config) {
13
8
  return (0, _objectHash).default(config, {
14
9
  ignoreUnknown: true
15
10
  });
16
11
  }
12
+ function _interopRequireDefault(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = isKeyframeRule;
6
6
  function isKeyframeRule(rule) {
7
- return rule.parent && rule.parent.type === 'atrule' && /keyframes$/.test(rule.parent.name);
7
+ return rule.parent && rule.parent.type === "atrule" && /keyframes$/.test(rule.parent.name);
8
8
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = isPlainObject;
6
6
  function isPlainObject(value) {
7
- if (Object.prototype.toString.call(value) !== '[object Object]') {
7
+ if (Object.prototype.toString.call(value) !== "[object Object]") {
8
8
  return false;
9
9
  }
10
10
  const prototype = Object.getPrototypeOf(value);
@@ -3,44 +3,20 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.default = isValidArbitraryValue;
6
- let matchingBrackets = new Map([
7
- [
8
- '{',
9
- '}'
10
- ],
11
- [
12
- '[',
13
- ']'
14
- ],
15
- [
16
- '(',
17
- ')'
18
- ],
19
- ]);
20
- let inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v])=>[
21
- v,
22
- k
23
- ]
24
- ));
25
- let quotes = new Set([
26
- '"',
27
- "'",
28
- '`'
29
- ]);
30
6
  function isValidArbitraryValue(value) {
31
7
  let stack = [];
32
8
  let inQuotes = false;
33
9
  for(let i = 0; i < value.length; i++){
34
10
  let char = value[i];
35
- if (char === ':' && !inQuotes && stack.length === 0) {
11
+ if (char === ":" && !inQuotes && stack.length === 0) {
36
12
  return false;
37
13
  }
38
14
  // Non-escaped quotes allow us to "allow" anything in between
39
- if (quotes.has(char) && value[i - 1] !== '\\') {
15
+ if (quotes.has(char) && value[i - 1] !== "\\") {
40
16
  inQuotes = !inQuotes;
41
17
  }
42
18
  if (inQuotes) continue;
43
- if (value[i - 1] === '\\') continue; // Escaped
19
+ if (value[i - 1] === "\\") continue; // Escaped
44
20
  if (matchingBrackets.has(char)) {
45
21
  stack.push(char);
46
22
  } else if (inverseMatchingBrackets.has(char)) {
@@ -62,3 +38,27 @@ function isValidArbitraryValue(value) {
62
38
  // All good, totally balanced!
63
39
  return true;
64
40
  }
41
+ let matchingBrackets = new Map([
42
+ [
43
+ "{",
44
+ "}"
45
+ ],
46
+ [
47
+ "[",
48
+ "]"
49
+ ],
50
+ [
51
+ "(",
52
+ ")"
53
+ ],
54
+ ]);
55
+ let inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v])=>[
56
+ v,
57
+ k
58
+ ]
59
+ ));
60
+ let quotes = new Set([
61
+ '"',
62
+ "'",
63
+ "`"
64
+ ]);