tailwindcss 3.0.5 → 3.0.9

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
@@ -9,6 +9,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  - Nothing yet!
11
11
 
12
+ ## [3.0.9] - 2022-01-03
13
+
14
+ ### Fixed
15
+
16
+ - Improve `DEBUG` flag ([#6797](https://github.com/tailwindlabs/tailwindcss/pull/6797), [#6804](https://github.com/tailwindlabs/tailwindcss/pull/6804))
17
+ - Ensure we can use `<` and `>` characters in modifiers ([#6851](https://github.com/tailwindlabs/tailwindcss/pull/6851))
18
+ - Validate `theme()` works in arbitrary values ([#6852](https://github.com/tailwindlabs/tailwindcss/pull/6852))
19
+ - Properly detect `theme()` value usage in arbitrary properties ([#6854](https://github.com/tailwindlabs/tailwindcss/pull/6854))
20
+ - Improve collapsing of duplicate declarations ([#6856](https://github.com/tailwindlabs/tailwindcss/pull/6856))
21
+ - Remove support for `TAILWIND_MODE=watch` ([#6858](https://github.com/tailwindlabs/tailwindcss/pull/6858))
22
+
23
+ ## [3.0.8] - 2021-12-28
24
+
25
+ ### Fixed
26
+
27
+ - Reduce specificity of `abbr` rule in preflight ([#6671](https://github.com/tailwindlabs/tailwindcss/pull/6671))
28
+ - Support HSL with hue units in arbitrary values ([#6726](https://github.com/tailwindlabs/tailwindcss/pull/6726))
29
+ - Add `node16-linux-arm64` target for standalone CLI ([#6693](https://github.com/tailwindlabs/tailwindcss/pull/6693))
30
+
31
+ ## [3.0.7] - 2021-12-17
32
+
33
+ ### Fixed
34
+
35
+ - Don't mutate custom color palette when overriding per-plugin colors ([#6546](https://github.com/tailwindlabs/tailwindcss/pull/6546))
36
+ - Improve circular dependency detection when using `@apply` ([#6588](https://github.com/tailwindlabs/tailwindcss/pull/6588))
37
+ - Only generate variants for non-`user` layers ([#6589](https://github.com/tailwindlabs/tailwindcss/pull/6589))
38
+ - Properly extract classes with arbitrary values in arrays and classes followed by escaped quotes ([#6590](https://github.com/tailwindlabs/tailwindcss/pull/6590))
39
+ - Improve jsx interpolation candidate matching ([#6593](https://github.com/tailwindlabs/tailwindcss/pull/6593))
40
+ - Ensure `@apply` of a rule inside an AtRule works ([#6594](https://github.com/tailwindlabs/tailwindcss/pull/6594))
41
+
42
+ ## [3.0.6] - 2021-12-16
43
+
44
+ ### Fixed
45
+
46
+ - Support square bracket notation in paths ([#6519](https://github.com/tailwindlabs/tailwindcss/pull/6519))
47
+ - Ensure all plugins are executed for a given candidate ([#6540](https://github.com/tailwindlabs/tailwindcss/pull/6540))
48
+
12
49
  ## [3.0.5] - 2021-12-15
13
50
 
14
51
  ### Fixed
@@ -19,7 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
56
 
20
57
  ### Fixed
21
58
 
22
- - Insert always on defaults layer in correct spot ([#6526](https://github.com/tailwindlabs/tailwindcss/pull/6526))
59
+ - Insert always-on defaults layer in correct spot ([#6526](https://github.com/tailwindlabs/tailwindcss/pull/6526))
23
60
 
24
61
  ## [3.0.3] - 2021-12-15
25
62
 
@@ -34,7 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
34
71
  - Don't output unparsable values ([#6469](https://github.com/tailwindlabs/tailwindcss/pull/6469))
35
72
  - Fix text decoration utilities from overriding the new text decoration color/style/thickness utilities when used with a modifier ([#6378](https://github.com/tailwindlabs/tailwindcss/pull/6378))
36
73
  - Move defaults to their own always-on layer ([#6500](https://github.com/tailwindlabs/tailwindcss/pull/6500))
37
- - Support negative values in safelist patterns ([6480](https://github.com/tailwindlabs/tailwindcss/pull/6480))
74
+ - Support negative values in safelist patterns ([#6480](https://github.com/tailwindlabs/tailwindcss/pull/6480))
38
75
 
39
76
  ## [3.0.2] - 2021-12-13
40
77
 
@@ -1723,7 +1760,11 @@ No release notes
1723
1760
 
1724
1761
  - Everything!
1725
1762
 
1726
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.5...HEAD
1763
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.9...HEAD
1764
+ [3.0.9]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.8...v3.0.9
1765
+ [3.0.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.7...v3.0.8
1766
+ [3.0.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.6...v3.0.7
1767
+ [3.0.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.5...v3.0.6
1727
1768
  [3.0.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.4...v3.0.5
1728
1769
  [3.0.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.3...v3.0.4
1729
1770
  [3.0.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.2...v3.0.3
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  <p>
2
- <a href="https://tailwindcss.com/" target="_blank">
3
- <img alt="Tailwind CSS" width="350" src="https://refactoringui.nyc3.cdn.digitaloceanspaces.com/tailwind-logo-sticker.svg">
4
- </a><br>
5
- A utility-first CSS framework for rapidly building custom user interfaces.
2
+ <a href="https://tailwindcss.com/#gh-light-mode-only" target="_blank">
3
+ <img src="./.github/logo-light.svg" alt="Tailwind CSS" width="350" height="70">
4
+ </a>
5
+ <a href="https://tailwindcss.com/#gh-dark-mode-only" target="_blank">
6
+ <img src="./.github/logo-dark.svg" alt="Tailwind CSS" width="350" height="70">
7
+ </a>
6
8
  </p>
7
9
 
10
+ A utility-first CSS framework for rapidly building custom user interfaces.
11
+
8
12
  <p>
9
13
  <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/workflow/status/tailwindlabs/tailwindcss/Node.js%20CI" alt="Build Status"></a>
10
14
  <a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
@@ -58,7 +58,7 @@ hr {
58
58
  Add the correct text decoration in Chrome, Edge, and Safari.
59
59
  */
60
60
 
61
- abbr[title] {
61
+ abbr:where([title]) {
62
62
  text-decoration: underline dotted;
63
63
  }
64
64
 
package/lib/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  var _setupTrackingContext = _interopRequireDefault(require("./lib/setupTrackingContext"));
3
- var _setupWatchingContext = _interopRequireDefault(require("./lib/setupWatchingContext"));
4
3
  var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
5
4
  var _sharedState = require("./lib/sharedState");
6
5
  function _interopRequireDefault(obj) {
@@ -18,8 +17,7 @@ module.exports = function tailwindcss(configOrPath) {
18
17
  return root;
19
18
  },
20
19
  function(root, result) {
21
- let setupContext = _sharedState.env.TAILWIND_MODE === 'watch' ? (0, _setupWatchingContext).default(configOrPath) : (0, _setupTrackingContext).default(configOrPath);
22
- (0, _processTailwindFeatures).default(setupContext)(root, result);
20
+ (0, _processTailwindFeatures).default((0, _setupTrackingContext).default(configOrPath))(root, result);
23
21
  },
24
22
  _sharedState.env.DEBUG && function(root) {
25
23
  console.timeEnd('JIT TOTAL');
@@ -8,6 +8,7 @@ function collapseDuplicateDeclarations() {
8
8
  root.walkRules((node)=>{
9
9
  let seen = new Map();
10
10
  let droppable = new Set([]);
11
+ let byProperty = new Map();
11
12
  node.walkDecls((decl)=>{
12
13
  // This could happen if we have nested selectors. In that case the
13
14
  // parent will loop over all its declarations but also the declarations
@@ -17,13 +18,63 @@ function collapseDuplicateDeclarations() {
17
18
  return;
18
19
  }
19
20
  if (seen.has(decl.prop)) {
20
- droppable.add(seen.get(decl.prop));
21
+ // Exact same value as what we have seen so far
22
+ if (seen.get(decl.prop).value === decl.value) {
23
+ // Keep the last one, drop the one we've seen so far
24
+ droppable.add(seen.get(decl.prop));
25
+ // Override the existing one with the new value. This is necessary
26
+ // so that if we happen to have more than one declaration with the
27
+ // same value, that we keep removing the previous one. Otherwise we
28
+ // will only remove the *first* one.
29
+ seen.set(decl.prop, decl);
30
+ return;
31
+ }
32
+ // Not the same value, so we need to check if we can merge it so
33
+ // let's collect it first.
34
+ if (!byProperty.has(decl.prop)) {
35
+ byProperty.set(decl.prop, new Set());
36
+ }
37
+ byProperty.get(decl.prop).add(seen.get(decl.prop));
38
+ byProperty.get(decl.prop).add(decl);
21
39
  }
22
40
  seen.set(decl.prop, decl);
23
41
  });
42
+ // Drop all the duplicate declarations with the exact same value we've
43
+ // already seen so far.
24
44
  for (let decl1 of droppable){
25
45
  decl1.remove();
26
46
  }
47
+ // Analyze the declarations based on its unit, drop all the declarations
48
+ // with the same unit but the last one in the list.
49
+ for (let declarations of byProperty.values()){
50
+ let byUnit = new Map();
51
+ for (let decl of declarations){
52
+ let unit = resolveUnit(decl.value);
53
+ if (unit === null) {
54
+ continue;
55
+ }
56
+ if (!byUnit.has(unit)) {
57
+ byUnit.set(unit, new Set());
58
+ }
59
+ byUnit.get(unit).add(decl);
60
+ }
61
+ for (let declarations1 of byUnit.values()){
62
+ // Get all but the last one
63
+ let removableDeclarations = Array.from(declarations1).slice(0, -1);
64
+ for (let decl of removableDeclarations){
65
+ decl.remove();
66
+ }
67
+ }
68
+ }
27
69
  });
28
70
  };
29
71
  }
72
+ let UNITLESS_NUMBER = Symbol('unitless-number');
73
+ function resolveUnit(input) {
74
+ let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
75
+ if (result) {
76
+ var ref;
77
+ return (ref = result[1]) !== null && ref !== void 0 ? ref : UNITLESS_NUMBER;
78
+ }
79
+ return null;
80
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.defaultExtractor = defaultExtractor;
6
+ const PATTERNS = [
7
+ /(?:\['([^'\s]+[^<>"'`\s:\\])')/.source,
8
+ /(?:\["([^"\s]+[^<>"'`\s:\\])")/.source,
9
+ /(?:\[`([^`\s]+[^<>"'`\s:\\])`)/.source,
10
+ /([^<>"'`\s]*\[\w*'[^"`\s]*'?\])/.source,
11
+ /([^<>"'`\s]*\[\w*"[^'`\s]*"?\])/.source,
12
+ /([^<>"'`\s]*\[\w*\('[^"'`\s]*'\)\])/.source,
13
+ /([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source,
14
+ /([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source,
15
+ /([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
16
+ /([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
17
+ /([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
18
+ /([^<>"'`\s]*\[[^<>"'`\s]*:[^\]\s]*\])/.source,
19
+ /([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source,
20
+ /([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source,
21
+ /([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source,
22
+ /([^"'`\s]*[^<>"'`\s:\\])/.source,
23
+ /([^<>"'`\s]*[^"'`\s:\\])/.source,
24
+ ].join('|');
25
+ const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
26
+ const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
27
+ function defaultExtractor(content) {
28
+ let broadMatches = content.matchAll(BROAD_MATCH_GLOBAL_REGEXP);
29
+ let innerMatches = content.match(INNER_MATCH_GLOBAL_REGEXP) || [];
30
+ let results = [
31
+ ...broadMatches,
32
+ ...innerMatches
33
+ ].flat().filter((v)=>v !== undefined
34
+ );
35
+ return results;
36
+ } // Regular utilities
37
+ // {{modifier}:}*{namespace}{-{suffix}}*{/{opacityModifier}}?
38
+ // Arbitrary values
39
+ // {{modifier}:}*{namespace}-[{arbitraryValue}]{/{opacityModifier}}?
40
+ // arbitraryValue: no whitespace, balanced quotes unless within quotes, balanced brackets unless within quotes
41
+ // Arbitrary properties
42
+ // {{modifier}:}*[{validCssPropertyName}:{arbitraryValue}]
@@ -43,7 +43,7 @@ function listKeys(obj) {
43
43
  function validatePath(config, path, defaultValue) {
44
44
  const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+/g, '').replace(/['"]+$/g, '');
45
45
  const pathSegments = Array.isArray(path) ? path : (0, _toPath).toPath(pathString);
46
- const value = (0, _dlv).default(config.theme, pathString, defaultValue);
46
+ const value = (0, _dlv).default(config.theme, pathSegments, defaultValue);
47
47
  if (value === undefined) {
48
48
  let error = `'${pathString}' does not exist in your theme config.`;
49
49
  const parentSegments = pathSegments.slice(0, -1);
@@ -13,17 +13,28 @@ function _interopRequireDefault(obj) {
13
13
  default: obj
14
14
  };
15
15
  }
16
- function containsBase(selector, classCandidateBase, separator) {
17
- return (0, _postcssSelectorParser).default((selectors)=>{
18
- let contains = false;
19
- selectors.walkClasses((classSelector)=>{
20
- if (classSelector.value.split(separator).pop() === classCandidateBase) {
21
- contains = true;
22
- return false;
23
- }
24
- });
25
- return contains;
26
- }).transformSync(selector);
16
+ function extractClasses(node) {
17
+ let classes = new Set();
18
+ let container = _postcss.default.root({
19
+ nodes: [
20
+ node.clone()
21
+ ]
22
+ });
23
+ container.walkRules((rule)=>{
24
+ (0, _postcssSelectorParser).default((selectors)=>{
25
+ selectors.walkClasses((classSelector)=>{
26
+ classes.add(classSelector.value);
27
+ });
28
+ }).processSync(rule.selector);
29
+ });
30
+ return Array.from(classes);
31
+ }
32
+ function extractBaseCandidates(candidates, separator) {
33
+ let baseClasses = new Set();
34
+ for (let candidate of candidates){
35
+ baseClasses.add(candidate.split(separator).pop());
36
+ }
37
+ return Array.from(baseClasses);
27
38
  }
28
39
  function prefix(context, selector) {
29
40
  let prefix1 = context.tailwindConfig.prefix;
@@ -186,10 +197,36 @@ function processApply(root, context) {
186
197
  for (const [parent, candidates] of perParentApplies){
187
198
  let siblings = [];
188
199
  for (let [applyCandidate, important, rules] of candidates){
189
- let base = applyCandidate.split(context.tailwindConfig.separator).pop();
190
200
  for (let [meta, node] of rules){
191
- if (containsBase(parent.selector, base, context.tailwindConfig.separator) && containsBase(node.selector, base, context.tailwindConfig.separator)) {
192
- throw node.error(`Circular dependency detected when using: \`@apply ${applyCandidate}\``);
201
+ let parentClasses = extractClasses(parent);
202
+ let nodeClasses = extractClasses(node);
203
+ // Add base utility classes from the @apply node to the list of
204
+ // classes to check whether it intersects and therefore results in a
205
+ // circular dependency or not.
206
+ //
207
+ // E.g.:
208
+ // .foo {
209
+ // @apply hover:a; // This applies "a" but with a modifier
210
+ // }
211
+ //
212
+ // We only have to do that with base classes of the `node`, not of the `parent`
213
+ // E.g.:
214
+ // .hover\:foo {
215
+ // @apply bar;
216
+ // }
217
+ // .bar {
218
+ // @apply foo;
219
+ // }
220
+ //
221
+ // This should not result in a circular dependency because we are
222
+ // just applying `.foo` and the rule above is `.hover\:foo` which is
223
+ // unrelated. However, if we were to apply `hover:foo` then we _did_
224
+ // have to include this one.
225
+ nodeClasses = nodeClasses.concat(extractBaseCandidates(nodeClasses, context.tailwindConfig.separator));
226
+ let intersects = parentClasses.some((selector)=>nodeClasses.includes(selector)
227
+ );
228
+ if (intersects) {
229
+ throw node.error(`You cannot \`@apply\` the \`${applyCandidate}\` utility here because it creates a circular dependency.`);
193
230
  }
194
231
  let root = _postcss.default.root({
195
232
  nodes: [
@@ -199,6 +236,42 @@ function processApply(root, context) {
199
236
  let canRewriteSelector = node.type !== 'atrule' || node.type === 'atrule' && node.name !== 'keyframes';
200
237
  if (canRewriteSelector) {
201
238
  root.walkRules((rule)=>{
239
+ // Let's imagine you have the following structure:
240
+ //
241
+ // .foo {
242
+ // @apply bar;
243
+ // }
244
+ //
245
+ // @supports (a: b) {
246
+ // .bar {
247
+ // color: blue
248
+ // }
249
+ //
250
+ // .something-unrelated {}
251
+ // }
252
+ //
253
+ // In this case we want to apply `.bar` but it happens to be in
254
+ // an atrule node. We clone that node instead of the nested one
255
+ // because we still want that @supports rule to be there once we
256
+ // applied everything.
257
+ //
258
+ // However it happens to be that the `.something-unrelated` is
259
+ // also in that same shared @supports atrule. This is not good,
260
+ // and this should not be there. The good part is that this is
261
+ // a clone already and it can be safely removed. The question is
262
+ // how do we know we can remove it. Basically what we can do is
263
+ // match it against the applyCandidate that you want to apply. If
264
+ // it doesn't match the we can safely delete it.
265
+ //
266
+ // If we didn't do this, then the `replaceSelector` function
267
+ // would have replaced this with something that didn't exist and
268
+ // therefore it removed the selector altogether. In this specific
269
+ // case it would result in `{}` instead of `.something-unrelated {}`
270
+ if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate
271
+ )) {
272
+ rule.remove();
273
+ return;
274
+ }
202
275
  rule.selector = replaceSelector(parent.selector, rule.selector, applyCandidate);
203
276
  rule.walkDecls((d)=>{
204
277
  d.important = meta.important || important;
@@ -220,7 +293,6 @@ function processApply(root, context) {
220
293
  let nodes = siblings.sort(([a], [z])=>(0, _bigSign).default(a.sort - z.sort)
221
294
  ).map((s)=>s[1]
222
295
  );
223
- // console.log(parent)
224
296
  // `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
225
297
  parent.after(nodes);
226
298
  }
@@ -9,6 +9,7 @@ var sharedState = _interopRequireWildcard(require("./sharedState"));
9
9
  var _generateRules = require("./generateRules");
10
10
  var _bigSign = _interopRequireDefault(require("../util/bigSign"));
11
11
  var _cloneNodes = _interopRequireDefault(require("../util/cloneNodes"));
12
+ var _defaultExtractor = require("./defaultExtractor");
12
13
  function _interopRequireDefault(obj) {
13
14
  return obj && obj.__esModule ? obj : {
14
15
  default: obj
@@ -38,31 +39,8 @@ function _interopRequireWildcard(obj) {
38
39
  }
39
40
  }
40
41
  let env = sharedState.env;
41
- const PATTERNS = [
42
- /([^<>"'`\s]*\[\w*'[^"`\s]*'?\])/.source,
43
- /([^<>"'`\s]*\[\w*"[^"`\s]*"?\])/.source,
44
- /([^<>"'`\s]*\[\w*\('[^"'`\s]*'\)\])/.source,
45
- /([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source,
46
- /([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source,
47
- /([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
48
- /([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
49
- /([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
50
- /([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source,
51
- /([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source,
52
- /([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source,
53
- /([^<>"'`\s]*[^"'`\s:])/.source
54
- ].join('|');
55
- const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
56
- const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/g;
57
42
  const builtInExtractors = {
58
- DEFAULT: (content)=>{
59
- let broadMatches = content.match(BROAD_MATCH_GLOBAL_REGEXP) || [];
60
- let innerMatches = content.match(INNER_MATCH_GLOBAL_REGEXP) || [];
61
- return [
62
- ...broadMatches,
63
- ...innerMatches
64
- ];
65
- }
43
+ DEFAULT: _defaultExtractor.defaultExtractor
66
44
  };
67
45
  const builtInTransformers = {
68
46
  DEFAULT: (content)=>content
@@ -124,6 +124,10 @@ function applyVariant(variant, matches, context) {
124
124
  let variantFunctionTuples = context.variantMap.get(variant);
125
125
  let result = [];
126
126
  for (let [meta, rule1] of matches){
127
+ // Don't generate variants for user css
128
+ if (meta.layer === 'user') {
129
+ continue;
130
+ }
127
131
  let container = _postcss.default.root({
128
132
  nodes: [
129
133
  rule1.clone()
@@ -331,7 +335,6 @@ function* resolveMatchedPlugins(classCandidate, context) {
331
335
  context.candidateRuleMap.get(prefix),
332
336
  negative ? `-${modifier}` : modifier
333
337
  ];
334
- return;
335
338
  }
336
339
  }
337
340
  }
@@ -2,13 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ exports.resolveDebug = resolveDebug;
5
6
  exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
6
7
  const env = {
7
- TAILWIND_MODE: process.env.TAILWIND_MODE,
8
8
  NODE_ENV: process.env.NODE_ENV,
9
- DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== '0',
10
- TAILWIND_DISABLE_TOUCH: process.env.TAILWIND_DISABLE_TOUCH !== undefined,
11
- TAILWIND_TOUCH_DIR: process.env.TAILWIND_TOUCH_DIR
9
+ DEBUG: resolveDebug(process.env.DEBUG)
12
10
  };
13
11
  exports.env = env;
14
12
  const contextMap = new Map();
@@ -17,3 +15,34 @@ const configContextMap = new Map();
17
15
  exports.configContextMap = configContextMap;
18
16
  const contextSourcesMap = new Map();
19
17
  exports.contextSourcesMap = contextSourcesMap;
18
+ function resolveDebug(debug) {
19
+ if (debug === undefined) {
20
+ return false;
21
+ }
22
+ // Environment variables are strings, so convert to boolean
23
+ if (debug === 'true' || debug === '1') {
24
+ return true;
25
+ }
26
+ if (debug === 'false' || debug === '0') {
27
+ return false;
28
+ }
29
+ // Keep the debug convention into account:
30
+ // DEBUG=* -> This enables all debug modes
31
+ // DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
32
+ // DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
33
+ // DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
34
+ if (debug === '*') {
35
+ return true;
36
+ }
37
+ let debuggers = debug.split(',').map((d)=>d.split(':')[0]
38
+ );
39
+ // Ignoring tailwindcss
40
+ if (debuggers.includes('-tailwindcss')) {
41
+ return false;
42
+ }
43
+ // Including tailwindcss
44
+ if (debuggers.includes('tailwindcss')) {
45
+ return true;
46
+ }
47
+ return false;
48
+ }
package/lib/util/color.js CHANGED
@@ -15,7 +15,8 @@ let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
15
15
  let VALUE = `(?:\\d+|\\d*\\.\\d+)%?`;
16
16
  let SEP = `(?:\\s*,\\s*|\\s+)`;
17
17
  let ALPHA_SEP = `\\s*[,/]\\s*`;
18
- let RGB_HSL = new RegExp(`^(rgb|hsl)a?\\(\\s*(${VALUE})${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\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*\\)$`);
19
20
  function parseColor(value) {
20
21
  if (typeof value !== 'string') {
21
22
  return null;
@@ -62,18 +63,32 @@ function parseColor(value) {
62
63
  alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined
63
64
  };
64
65
  }
65
- let match = value.match(RGB_HSL);
66
- if (match !== null) {
66
+ let rgbMatch = value.match(RGB);
67
+ if (rgbMatch !== null) {
67
68
  var ref, ref1;
68
69
  return {
69
- mode: match[1],
70
+ mode: 'rgb',
71
+ color: [
72
+ rgbMatch[1],
73
+ rgbMatch[2],
74
+ rgbMatch[3]
75
+ ].map((v)=>v.toString()
76
+ ),
77
+ alpha: (ref = rgbMatch[4]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
78
+ };
79
+ }
80
+ let hslMatch = value.match(HSL);
81
+ if (hslMatch !== null) {
82
+ var ref2, ref3;
83
+ return {
84
+ mode: 'hsl',
70
85
  color: [
71
- match[2],
72
- match[3],
73
- match[4]
86
+ hslMatch[1],
87
+ hslMatch[2],
88
+ hslMatch[3]
74
89
  ].map((v)=>v.toString()
75
90
  ),
76
- alpha: (ref = match[5]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
91
+ alpha: (ref2 = hslMatch[4]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.toString) === null || ref3 === void 0 ? void 0 : ref3.call(ref2)
77
92
  };
78
93
  }
79
94
  return null;
@@ -11,6 +11,8 @@ var _colors = _interopRequireDefault(require("../public/colors"));
11
11
  var _defaults = require("./defaults");
12
12
  var _toPath = require("./toPath");
13
13
  var _normalizeConfig = require("./normalizeConfig");
14
+ var _isPlainObject = _interopRequireDefault(require("./isPlainObject"));
15
+ var _cloneDeep = require("./cloneDeep");
14
16
  function _interopRequireDefault(obj) {
15
17
  return obj && obj.__esModule ? obj : {
16
18
  default: obj
@@ -143,7 +145,13 @@ function resolveFunctionKeys(object) {
143
145
  val = val[path[index++]];
144
146
  val = isFunction(val) ? val(resolvePath, configUtils) : val;
145
147
  }
146
- return val === undefined ? defaultValue : val;
148
+ if (val === undefined) {
149
+ return defaultValue;
150
+ }
151
+ if ((0, _isPlainObject).default(val)) {
152
+ return (0, _cloneDeep).cloneDeep(val);
153
+ }
154
+ return val;
147
155
  };
148
156
  resolvePath.theme = resolvePath;
149
157
  for(let key1 in configUtils){
@@ -5,5 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  exports.toPath = toPath;
6
6
  function toPath(path) {
7
7
  if (Array.isArray(path)) return path;
8
- return path.split(/[\.\]\[]+/g);
8
+ let openBrackets = path.split('[').length - 1;
9
+ let closedBrackets = path.split(']').length - 1;
10
+ if (openBrackets !== closedBrackets) {
11
+ throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
12
+ }
13
+ return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
9
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.0.5",
3
+ "version": "3.0.9",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -25,7 +25,7 @@
25
25
  "prepublishOnly": "npm install --force && npm run swcify",
26
26
  "style": "eslint .",
27
27
  "pretest": "npm run generate:plugin-list",
28
- "test": "cross-env TAILWIND_MODE=build jest",
28
+ "test": "jest",
29
29
  "test:integrations": "npm run test --prefix ./integrations",
30
30
  "install:integrations": "node scripts/install-integrations.js",
31
31
  "posttest": "npm run style",
@@ -43,22 +43,22 @@
43
43
  "*.js"
44
44
  ],
45
45
  "devDependencies": {
46
- "@swc/cli": "^0.1.52",
46
+ "@swc/cli": "^0.1.55",
47
47
  "@swc/core": "^1.2.118",
48
- "@swc/jest": "^0.2.11",
48
+ "@swc/jest": "^0.2.15",
49
49
  "@swc/register": "^0.1.7",
50
50
  "autoprefixer": "^10.4.0",
51
51
  "cross-env": "^7.0.3",
52
- "cssnano": "^5.0.12",
52
+ "cssnano": "^5.0.14",
53
53
  "esbuild": "^0.14.2",
54
54
  "eslint": "^8.4.1",
55
55
  "eslint-config-prettier": "^8.3.0",
56
56
  "eslint-plugin-prettier": "^4.0.0",
57
- "jest": "^27.4.3",
57
+ "jest": "^27.4.5",
58
58
  "jest-diff": "^27.4.2",
59
- "postcss": "^8.4.4",
59
+ "postcss": "^8.4.5",
60
60
  "postcss-cli": "^8.3.1",
61
- "prettier": "^2.5.0",
61
+ "prettier": "^2.5.1",
62
62
  "rimraf": "^3.0.0"
63
63
  },
64
64
  "peerDependencies": {
@@ -82,11 +82,10 @@
82
82
  "postcss-js": "^3.0.3",
83
83
  "postcss-load-config": "^3.1.0",
84
84
  "postcss-nested": "5.0.6",
85
- "postcss-selector-parser": "^6.0.6",
85
+ "postcss-selector-parser": "^6.0.7",
86
86
  "postcss-value-parser": "^4.2.0",
87
87
  "quick-lru": "^5.1.1",
88
- "resolve": "^1.20.0",
89
- "tmp": "^0.2.1"
88
+ "resolve": "^1.20.0"
90
89
  },
91
90
  "browserslist": [
92
91
  "> 1%",