tailwindcss 3.1.8 → 3.2.1

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 (101) hide show
  1. package/CHANGELOG.md +64 -3
  2. package/README.md +6 -5
  3. package/lib/cli/build/deps.js +54 -0
  4. package/lib/cli/build/index.js +44 -0
  5. package/lib/cli/build/plugin.js +351 -0
  6. package/lib/cli/build/utils.js +78 -0
  7. package/lib/cli/build/watching.js +113 -0
  8. package/lib/cli/help/index.js +71 -0
  9. package/lib/cli/index.js +18 -0
  10. package/lib/cli/init/index.js +46 -0
  11. package/lib/cli/shared.js +12 -0
  12. package/lib/cli.js +11 -590
  13. package/lib/corePlugins.js +332 -108
  14. package/lib/css/preflight.css +5 -0
  15. package/lib/featureFlags.js +7 -4
  16. package/lib/index.js +6 -1
  17. package/lib/lib/content.js +167 -0
  18. package/lib/lib/defaultExtractor.js +15 -10
  19. package/lib/lib/detectNesting.js +2 -2
  20. package/lib/lib/evaluateTailwindFunctions.js +17 -1
  21. package/lib/lib/expandApplyAtRules.js +66 -37
  22. package/lib/lib/expandTailwindAtRules.js +10 -42
  23. package/lib/lib/findAtConfigPath.js +44 -0
  24. package/lib/lib/generateRules.js +180 -93
  25. package/lib/lib/normalizeTailwindDirectives.js +1 -1
  26. package/lib/lib/offsets.js +217 -0
  27. package/lib/lib/regex.js +1 -1
  28. package/lib/lib/setupContextUtils.js +339 -100
  29. package/lib/lib/setupTrackingContext.js +5 -39
  30. package/lib/lib/sharedState.js +2 -0
  31. package/lib/public/colors.js +1 -1
  32. package/lib/util/buildMediaQuery.js +6 -3
  33. package/lib/util/configurePlugins.js +1 -1
  34. package/lib/util/dataTypes.js +15 -19
  35. package/lib/util/formatVariantSelector.js +92 -8
  36. package/lib/util/getAllConfigs.js +14 -3
  37. package/lib/util/isValidArbitraryValue.js +1 -1
  38. package/lib/util/nameClass.js +3 -0
  39. package/lib/util/negateValue.js +15 -2
  40. package/lib/util/normalizeConfig.js +17 -3
  41. package/lib/util/normalizeScreens.js +100 -3
  42. package/lib/util/parseAnimationValue.js +1 -1
  43. package/lib/util/parseBoxShadowValue.js +1 -1
  44. package/lib/util/parseDependency.js +33 -54
  45. package/lib/util/parseGlob.js +34 -0
  46. package/lib/util/parseObjectStyles.js +1 -1
  47. package/lib/util/pluginUtils.js +87 -17
  48. package/lib/util/resolveConfig.js +2 -2
  49. package/lib/util/splitAtTopLevelOnly.js +31 -81
  50. package/lib/util/transformThemeValue.js +9 -2
  51. package/lib/util/validateConfig.js +1 -1
  52. package/lib/util/validateFormalSyntax.js +24 -0
  53. package/package.json +14 -13
  54. package/peers/index.js +3263 -1887
  55. package/plugin.d.ts +3 -3
  56. package/scripts/release-channel.js +18 -0
  57. package/scripts/release-notes.js +21 -0
  58. package/src/cli/build/deps.js +56 -0
  59. package/src/cli/build/index.js +45 -0
  60. package/src/cli/build/plugin.js +417 -0
  61. package/src/cli/build/utils.js +76 -0
  62. package/src/cli/build/watching.js +134 -0
  63. package/src/cli/help/index.js +70 -0
  64. package/src/cli/index.js +3 -0
  65. package/src/cli/init/index.js +50 -0
  66. package/src/cli/shared.js +5 -0
  67. package/src/cli.js +4 -696
  68. package/src/corePlugins.js +262 -39
  69. package/src/css/preflight.css +5 -0
  70. package/src/featureFlags.js +12 -2
  71. package/src/index.js +5 -0
  72. package/src/lib/content.js +205 -0
  73. package/src/lib/defaultExtractor.js +3 -0
  74. package/src/lib/evaluateTailwindFunctions.js +22 -1
  75. package/src/lib/expandApplyAtRules.js +70 -29
  76. package/src/lib/expandTailwindAtRules.js +8 -46
  77. package/src/lib/findAtConfigPath.js +48 -0
  78. package/src/lib/generateRules.js +223 -101
  79. package/src/lib/offsets.js +270 -0
  80. package/src/lib/setupContextUtils.js +376 -89
  81. package/src/lib/setupTrackingContext.js +4 -45
  82. package/src/lib/sharedState.js +2 -0
  83. package/src/util/buildMediaQuery.js +5 -3
  84. package/src/util/dataTypes.js +15 -17
  85. package/src/util/formatVariantSelector.js +113 -9
  86. package/src/util/getAllConfigs.js +14 -2
  87. package/src/util/nameClass.js +4 -0
  88. package/src/util/negateValue.js +10 -2
  89. package/src/util/normalizeConfig.js +22 -2
  90. package/src/util/normalizeScreens.js +99 -4
  91. package/src/util/parseBoxShadowValue.js +1 -1
  92. package/src/util/parseDependency.js +37 -42
  93. package/src/util/parseGlob.js +24 -0
  94. package/src/util/pluginUtils.js +96 -14
  95. package/src/util/resolveConfig.js +1 -1
  96. package/src/util/splitAtTopLevelOnly.js +23 -49
  97. package/src/util/transformThemeValue.js +9 -1
  98. package/src/util/validateFormalSyntax.js +34 -0
  99. package/stubs/defaultConfig.stub.js +20 -3
  100. package/types/config.d.ts +48 -13
  101. package/types/generated/default-theme.d.ts +11 -0
@@ -1,4 +1,11 @@
1
- "use strict";
1
+ // @ts-check
2
+ /**
3
+ * @typedef {{type: 'dependency', file: string} | {type: 'dir-dependency', dir: string, glob: string}} Dependency
4
+ */ /**
5
+ *
6
+ * @param {import('../lib/content.js').ContentPath} contentPath
7
+ * @returns {Dependency[]}
8
+ */ "use strict";
2
9
  Object.defineProperty(exports, "__esModule", {
3
10
  value: true
4
11
  });
@@ -6,61 +13,33 @@ Object.defineProperty(exports, "default", {
6
13
  enumerable: true,
7
14
  get: ()=>parseDependency
8
15
  });
9
- const _isGlob = /*#__PURE__*/ _interopRequireDefault(require("is-glob"));
10
- const _globParent = /*#__PURE__*/ _interopRequireDefault(require("glob-parent"));
11
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
12
- function _interopRequireDefault(obj) {
13
- return obj && obj.__esModule ? obj : {
14
- default: obj
15
- };
16
- }
17
- // Based on `glob-base`
18
- // https://github.com/micromatch/glob-base/blob/master/index.js
19
- function parseGlob(pattern) {
20
- let glob = pattern;
21
- let base = (0, _globParent.default)(pattern);
22
- if (base !== ".") {
23
- glob = pattern.substr(base.length);
24
- if (glob.charAt(0) === "/") {
25
- glob = glob.substr(1);
26
- }
16
+ function parseDependency(contentPath) {
17
+ if (contentPath.ignore) {
18
+ return [];
27
19
  }
28
- if (glob.substr(0, 2) === "./") {
29
- glob = glob.substr(2);
20
+ if (!contentPath.glob) {
21
+ return [
22
+ {
23
+ type: "dependency",
24
+ file: contentPath.base
25
+ }
26
+ ];
30
27
  }
31
- if (glob.charAt(0) === "/") {
32
- glob = glob.substr(1);
33
- }
34
- return {
35
- base,
36
- glob
37
- };
38
- }
39
- function parseDependency(normalizedFileOrGlob) {
40
- if (normalizedFileOrGlob.startsWith("!")) {
41
- return null;
28
+ if (process.env.ROLLUP_WATCH === "true") {
29
+ // rollup-plugin-postcss does not support dir-dependency messages
30
+ // but directories can be watched in the same way as files
31
+ return [
32
+ {
33
+ type: "dependency",
34
+ file: contentPath.base
35
+ }
36
+ ];
42
37
  }
43
- let message;
44
- if ((0, _isGlob.default)(normalizedFileOrGlob)) {
45
- let { base , glob } = parseGlob(normalizedFileOrGlob);
46
- message = {
38
+ return [
39
+ {
47
40
  type: "dir-dependency",
48
- dir: _path.default.resolve(base),
49
- glob
50
- };
51
- } else {
52
- message = {
53
- type: "dependency",
54
- file: _path.default.resolve(normalizedFileOrGlob)
55
- };
56
- }
57
- // rollup-plugin-postcss does not support dir-dependency messages
58
- // but directories can be watched in the same way as files
59
- if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
60
- message = {
61
- type: "dependency",
62
- file: message.dir
63
- };
64
- }
65
- return message;
41
+ dir: contentPath.base,
42
+ glob: contentPath.glob
43
+ }
44
+ ];
66
45
  }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "parseGlob", {
6
+ enumerable: true,
7
+ get: ()=>parseGlob
8
+ });
9
+ const _globParent = /*#__PURE__*/ _interopRequireDefault(require("glob-parent"));
10
+ function _interopRequireDefault(obj) {
11
+ return obj && obj.__esModule ? obj : {
12
+ default: obj
13
+ };
14
+ }
15
+ function parseGlob(pattern) {
16
+ let glob = pattern;
17
+ let base = (0, _globParent.default)(pattern);
18
+ if (base !== ".") {
19
+ glob = pattern.substr(base.length);
20
+ if (glob.charAt(0) === "/") {
21
+ glob = glob.substr(1);
22
+ }
23
+ }
24
+ if (glob.substr(0, 2) === "./") {
25
+ glob = glob.substr(2);
26
+ }
27
+ if (glob.charAt(0) === "/") {
28
+ glob = glob.substr(1);
29
+ }
30
+ return {
31
+ base,
32
+ glob
33
+ };
34
+ }
@@ -26,7 +26,7 @@ function parseObjectStyles(styles) {
26
26
  bubble: [
27
27
  "screen"
28
28
  ]
29
- }),
29
+ })
30
30
  ]).process(style, {
31
31
  parser: _postcssJs.default
32
32
  }).root.nodes;
@@ -14,13 +14,17 @@ _export(exports, {
14
14
  parseColorFormat: ()=>parseColorFormat,
15
15
  asColor: ()=>asColor,
16
16
  asLookupValue: ()=>asLookupValue,
17
- coerceValue: ()=>coerceValue
17
+ typeMap: ()=>typeMap,
18
+ coerceValue: ()=>coerceValue,
19
+ getMatchingTypes: ()=>getMatchingTypes
18
20
  });
19
21
  const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
20
22
  const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
21
23
  const _withAlphaVariable = require("./withAlphaVariable");
22
24
  const _dataTypes = require("./dataTypes");
23
25
  const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
26
+ const _validateFormalSyntax = require("./validateFormalSyntax");
27
+ const _featureFlagsJs = require("../featureFlags.js");
24
28
  function _interopRequireDefault(obj) {
25
29
  return obj && obj.__esModule ? obj : {
26
30
  default: obj
@@ -76,11 +80,22 @@ function asValue(modifier, options = {}, { validate =()=>true } = {}) {
76
80
  function isArbitraryValue(input) {
77
81
  return input.startsWith("[") && input.endsWith("]");
78
82
  }
79
- function splitAlpha(modifier) {
83
+ function splitUtilityModifier(modifier) {
80
84
  let slashIdx = modifier.lastIndexOf("/");
81
85
  if (slashIdx === -1 || slashIdx === modifier.length - 1) {
82
86
  return [
83
- modifier
87
+ modifier,
88
+ undefined
89
+ ];
90
+ }
91
+ let arbitrary = isArbitraryValue(modifier);
92
+ // The modifier could be of the form `[foo]/[bar]`
93
+ // We want to handle this case properly
94
+ // without affecting `[foo/bar]`
95
+ if (arbitrary && !modifier.includes("]/[")) {
96
+ return [
97
+ modifier,
98
+ undefined
84
99
  ];
85
100
  }
86
101
  return [
@@ -95,13 +110,15 @@ function parseColorFormat(value) {
95
110
  }
96
111
  return value;
97
112
  }
98
- function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
113
+ function asColor(_, options = {}, { tailwindConfig ={} , utilityModifier , rawModifier } = {}) {
99
114
  var ref;
100
- if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
115
+ if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[rawModifier]) !== undefined) {
101
116
  var ref1;
102
- return parseColorFormat((ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier]);
117
+ return parseColorFormat((ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[rawModifier]);
103
118
  }
104
- let [color, alpha] = splitAlpha(modifier);
119
+ // TODO: Hoist this up to getMatchingTypes or something
120
+ // We do this here because we need the alpha value (if any)
121
+ let [color, alpha] = splitUtilityModifier(rawModifier);
105
122
  if (alpha !== undefined) {
106
123
  var ref2, ref3, ref4;
107
124
  var ref5;
@@ -118,7 +135,9 @@ function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
118
135
  }
119
136
  return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, tailwindConfig.theme.opacity[alpha]);
120
137
  }
121
- return asValue(modifier, options, {
138
+ return asValue(rawModifier, options, {
139
+ rawModifier,
140
+ utilityModifier,
122
141
  validate: _dataTypes.color
123
142
  });
124
143
  }
@@ -127,8 +146,9 @@ function asLookupValue(modifier, options = {}) {
127
146
  return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
128
147
  }
129
148
  function guess(validate) {
130
- return (modifier, options)=>{
149
+ return (modifier, options, extras)=>{
131
150
  return asValue(modifier, options, {
151
+ ...extras,
132
152
  validate
133
153
  });
134
154
  };
@@ -148,7 +168,8 @@ let typeMap = {
148
168
  "line-width": guess(_dataTypes.lineWidth),
149
169
  "absolute-size": guess(_dataTypes.absoluteSize),
150
170
  "relative-size": guess(_dataTypes.relativeSize),
151
- shadow: guess(_dataTypes.shadow)
171
+ shadow: guess(_dataTypes.shadow),
172
+ size: guess(_validateFormalSyntax.backgroundSize)
152
173
  };
153
174
  let supportedTypes = Object.keys(typeMap);
154
175
  function splitAtFirst(input, delim) {
@@ -177,19 +198,68 @@ function coerceValue(types, modifier, options, tailwindConfig) {
177
198
  if (value.length > 0 && supportedTypes.includes(explicitType)) {
178
199
  return [
179
200
  asValue(`[${value}]`, options),
180
- explicitType
201
+ explicitType,
202
+ null
181
203
  ];
182
204
  }
183
205
  }
206
+ let matches = getMatchingTypes(types, modifier, options, tailwindConfig);
184
207
  // Find first matching type
185
- for (let type of [].concat(types)){
186
- let result = typeMap[type](modifier, options, {
208
+ for (let match of matches){
209
+ return match;
210
+ }
211
+ return [];
212
+ }
213
+ function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
214
+ let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
215
+ let [modifier, utilityModifier] = splitUtilityModifier(rawModifier);
216
+ let canUseUtilityModifier = modifiersEnabled && options.modifiers != null && (options.modifiers === "any" || typeof options.modifiers === "object" && (utilityModifier && isArbitraryValue(utilityModifier) || utilityModifier in options.modifiers));
217
+ if (!canUseUtilityModifier) {
218
+ modifier = rawModifier;
219
+ utilityModifier = undefined;
220
+ }
221
+ if (utilityModifier !== undefined && modifier === "") {
222
+ modifier = "DEFAULT";
223
+ }
224
+ // Check the full value first
225
+ // TODO: Move to asValue… somehow
226
+ if (utilityModifier !== undefined) {
227
+ if (typeof options.modifiers === "object") {
228
+ var ref;
229
+ var ref1;
230
+ let configValue = (ref1 = (ref = options.modifiers) === null || ref === void 0 ? void 0 : ref[utilityModifier]) !== null && ref1 !== void 0 ? ref1 : null;
231
+ if (configValue !== null) {
232
+ utilityModifier = configValue;
233
+ } else if (isArbitraryValue(utilityModifier)) {
234
+ utilityModifier = utilityModifier.slice(1, -1);
235
+ }
236
+ }
237
+ let result = asValue(rawModifier, options, {
238
+ rawModifier,
239
+ utilityModifier,
240
+ tailwindConfig
241
+ });
242
+ if (result !== undefined) {
243
+ yield [
244
+ result,
245
+ "any",
246
+ null
247
+ ];
248
+ }
249
+ }
250
+ for (const { type } of types !== null && types !== void 0 ? types : []){
251
+ let result1 = typeMap[type](modifier, options, {
252
+ rawModifier,
253
+ utilityModifier,
187
254
  tailwindConfig
188
255
  });
189
- if (result !== undefined) return [
190
- result,
191
- type
256
+ if (result1 === undefined) {
257
+ continue;
258
+ }
259
+ yield [
260
+ result1,
261
+ type,
262
+ utilityModifier !== null && utilityModifier !== void 0 ? utilityModifier : null
192
263
  ];
193
264
  }
194
- return [];
195
265
  }
@@ -37,7 +37,7 @@ function mergeWith(target, ...sources) {
37
37
  let merged = customizer(target[k], source[k]);
38
38
  if (merged === undefined) {
39
39
  if (isObject(target[k]) && isObject(source[k])) {
40
- target[k] = mergeWith(target[k], source[k], customizer);
40
+ target[k] = mergeWith({}, target[k], source[k], customizer);
41
41
  } else {
42
42
  target[k] = source[k];
43
43
  }
@@ -244,7 +244,7 @@ function resolveConfig(configs) {
244
244
  important: false,
245
245
  separator: ":",
246
246
  variantOrder: _defaultConfigStub.default.variantOrder
247
- },
247
+ }
248
248
  ];
249
249
  var ref, ref1;
250
250
  return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
@@ -1,4 +1,18 @@
1
- "use strict";
1
+ /**
2
+ * This splits a string on a top-level character.
3
+ *
4
+ * Regex doesn't support recursion (at least not the JS-flavored version).
5
+ * So we have to use a tiny state machine to keep track of paren placement.
6
+ *
7
+ * Expected behavior using commas:
8
+ * var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
9
+ * ─┬─ ┬ ┬ ┬
10
+ * x x x ╰──────── Split because top-level
11
+ * ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
12
+ *
13
+ * @param {string} input
14
+ * @param {string} separator
15
+ */ "use strict";
2
16
  Object.defineProperty(exports, "__esModule", {
3
17
  value: true
4
18
  });
@@ -6,88 +20,24 @@ Object.defineProperty(exports, "splitAtTopLevelOnly", {
6
20
  enumerable: true,
7
21
  get: ()=>splitAtTopLevelOnly
8
22
  });
9
- const _regex = /*#__PURE__*/ _interopRequireWildcard(require("../lib/regex"));
10
- function _getRequireWildcardCache(nodeInterop) {
11
- if (typeof WeakMap !== "function") return null;
12
- var cacheBabelInterop = new WeakMap();
13
- var cacheNodeInterop = new WeakMap();
14
- return (_getRequireWildcardCache = function(nodeInterop) {
15
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
16
- })(nodeInterop);
17
- }
18
- function _interopRequireWildcard(obj, nodeInterop) {
19
- if (!nodeInterop && obj && obj.__esModule) {
20
- return obj;
21
- }
22
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
23
- return {
24
- default: obj
25
- };
26
- }
27
- var cache = _getRequireWildcardCache(nodeInterop);
28
- if (cache && cache.has(obj)) {
29
- return cache.get(obj);
30
- }
31
- var newObj = {};
32
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
33
- for(var key in obj){
34
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
35
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
36
- if (desc && (desc.get || desc.set)) {
37
- Object.defineProperty(newObj, key, desc);
38
- } else {
39
- newObj[key] = obj[key];
23
+ function splitAtTopLevelOnly(input, separator) {
24
+ let stack = [];
25
+ let parts = [];
26
+ let lastPos = 0;
27
+ for(let idx = 0; idx < input.length; idx++){
28
+ let char = input[idx];
29
+ if (stack.length === 0 && char === separator[0]) {
30
+ if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
31
+ parts.push(input.slice(lastPos, idx));
32
+ lastPos = idx + separator.length;
40
33
  }
41
34
  }
42
- }
43
- newObj.default = obj;
44
- if (cache) {
45
- cache.set(obj, newObj);
46
- }
47
- return newObj;
48
- }
49
- function* splitAtTopLevelOnly(input, separator) {
50
- let SPECIALS = new RegExp(`[(){}\\[\\]${_regex.escape(separator)}]`, "g");
51
- let depth = 0;
52
- let lastIndex = 0;
53
- let found = false;
54
- let separatorIndex = 0;
55
- let separatorStart = 0;
56
- let separatorLength = separator.length;
57
- // Find all paren-like things & character
58
- // And only split on commas if they're top-level
59
- for (let match of input.matchAll(SPECIALS)){
60
- let matchesSeparator = match[0] === separator[separatorIndex];
61
- let atEndOfSeparator = separatorIndex === separatorLength - 1;
62
- let matchesFullSeparator = matchesSeparator && atEndOfSeparator;
63
- if (match[0] === "(") depth++;
64
- if (match[0] === ")") depth--;
65
- if (match[0] === "[") depth++;
66
- if (match[0] === "]") depth--;
67
- if (match[0] === "{") depth++;
68
- if (match[0] === "}") depth--;
69
- if (matchesSeparator && depth === 0) {
70
- if (separatorStart === 0) {
71
- separatorStart = match.index;
72
- }
73
- separatorIndex++;
74
- }
75
- if (matchesFullSeparator && depth === 0) {
76
- found = true;
77
- yield input.substring(lastIndex, separatorStart);
78
- lastIndex = separatorStart + separatorLength;
35
+ if (char === "(" || char === "[" || char === "{") {
36
+ stack.push(char);
37
+ } else if (char === ")" && stack[stack.length - 1] === "(" || char === "]" && stack[stack.length - 1] === "[" || char === "}" && stack[stack.length - 1] === "{") {
38
+ stack.pop();
79
39
  }
80
- if (separatorIndex === separatorLength) {
81
- separatorIndex = 0;
82
- separatorStart = 0;
83
- }
84
- }
85
- // Provide the last segment of the string if available
86
- // Otherwise the whole string since no `char`s were found
87
- // This mirrors the behavior of string.split()
88
- if (found) {
89
- yield input.substring(lastIndex);
90
- } else {
91
- yield input;
92
40
  }
41
+ parts.push(input.slice(lastPos));
42
+ return parts;
93
43
  }
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "default", {
7
7
  get: ()=>transformThemeValue
8
8
  });
9
9
  const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
10
+ const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
10
11
  function _interopRequireDefault(obj) {
11
12
  return obj && obj.__esModule ? obj : {
12
13
  default: obj
@@ -23,8 +24,14 @@ function transformThemeValue(themeSection) {
23
24
  return value;
24
25
  };
25
26
  }
27
+ if (themeSection === "fontFamily") {
28
+ return (value)=>{
29
+ if (typeof value === "function") value = value({});
30
+ let families = Array.isArray(value) && (0, _isPlainObject.default)(value[1]) ? value[0] : value;
31
+ return Array.isArray(families) ? families.join(", ") : families;
32
+ };
33
+ }
26
34
  if ([
27
- "fontFamily",
28
35
  "boxShadow",
29
36
  "transitionProperty",
30
37
  "transitionDuration",
@@ -34,7 +41,7 @@ function transformThemeValue(themeSection) {
34
41
  "backgroundSize",
35
42
  "backgroundColor",
36
43
  "cursor",
37
- "animation",
44
+ "animation"
38
45
  ].includes(themeSection)) {
39
46
  return (value)=>{
40
47
  if (typeof value === "function") value = value({});
@@ -17,7 +17,7 @@ function validateConfig(config) {
17
17
  _log.default.warn("content-problems", [
18
18
  "The `content` option in your Tailwind CSS configuration is missing or empty.",
19
19
  "Configure your content sources or your generated CSS will be missing styles.",
20
- "https://tailwindcss.com/docs/content-configuration",
20
+ "https://tailwindcss.com/docs/content-configuration"
21
21
  ]);
22
22
  }
23
23
  return config;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "backgroundSize", {
6
+ enumerable: true,
7
+ get: ()=>backgroundSize
8
+ });
9
+ const _dataTypes = require("./dataTypes");
10
+ const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
11
+ function backgroundSize(value) {
12
+ let keywordValues = [
13
+ "cover",
14
+ "contain"
15
+ ];
16
+ // the <length-percentage> type will probably be a css function
17
+ // so we have to use `splitAtTopLevelOnly`
18
+ return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>{
19
+ let sizes = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(part, "_").filter(Boolean);
20
+ if (sizes.length === 1 && keywordValues.includes(sizes[0])) return true;
21
+ if (sizes.length !== 1 && sizes.length !== 2) return false;
22
+ return sizes.every((size)=>(0, _dataTypes.length)(size) || (0, _dataTypes.percentage)(size) || size === "auto");
23
+ });
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.1.8",
3
+ "version": "3.2.1",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -23,10 +23,11 @@
23
23
  "test": "jest",
24
24
  "test:integrations": "npm run test --prefix ./integrations",
25
25
  "install:integrations": "node scripts/install-integrations.js",
26
- "posttest": "npm run style",
27
26
  "generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js",
28
27
  "generate:types": "node -r @swc/register scripts/generate-types.js",
29
- "generate": "npm run generate:plugin-list && npm run generate:types"
28
+ "generate": "npm run generate:plugin-list && npm run generate:types",
29
+ "release-channel": "node ./scripts/release-channel.js",
30
+ "release-notes": "node ./scripts/release-notes.js"
30
31
  },
31
32
  "files": [
32
33
  "src/*",
@@ -43,19 +44,18 @@
43
44
  ],
44
45
  "devDependencies": {
45
46
  "@swc/cli": "^0.1.57",
46
- "@swc/core": "^1.2.218",
47
- "@swc/jest": "^0.2.22",
47
+ "@swc/core": "^1.3.4",
48
+ "@swc/jest": "^0.2.23",
48
49
  "@swc/register": "^0.1.10",
49
- "autoprefixer": "^10.4.8",
50
- "cssnano": "^5.1.12",
51
- "esbuild": "^0.14.48",
52
- "eslint": "^8.20.0",
50
+ "autoprefixer": "^10.4.12",
51
+ "cssnano": "^5.1.13",
52
+ "esbuild": "^0.15.10",
53
+ "eslint": "^8.25.0",
53
54
  "eslint-config-prettier": "^8.5.0",
54
55
  "eslint-plugin-prettier": "^4.2.1",
55
56
  "jest": "^28.1.3",
56
57
  "jest-diff": "^28.1.3",
57
58
  "prettier": "^2.7.1",
58
- "prettier-plugin-tailwindcss": "^0.1.13",
59
59
  "rimraf": "^3.0.0",
60
60
  "source-map-js": "^1.0.2"
61
61
  },
@@ -69,18 +69,19 @@
69
69
  "detective": "^5.2.1",
70
70
  "didyoumean": "^1.2.2",
71
71
  "dlv": "^1.1.3",
72
- "fast-glob": "^3.2.11",
72
+ "fast-glob": "^3.2.12",
73
73
  "glob-parent": "^6.0.2",
74
74
  "is-glob": "^4.0.3",
75
75
  "lilconfig": "^2.0.6",
76
+ "micromatch": "^4.0.5",
76
77
  "normalize-path": "^3.0.0",
77
78
  "object-hash": "^3.0.0",
78
79
  "picocolors": "^1.0.0",
79
- "postcss": "^8.4.14",
80
+ "postcss": "^8.4.17",
80
81
  "postcss-import": "^14.1.0",
81
82
  "postcss-js": "^4.0.0",
82
83
  "postcss-load-config": "^3.1.4",
83
- "postcss-nested": "5.0.6",
84
+ "postcss-nested": "6.0.0",
84
85
  "postcss-selector-parser": "^6.0.10",
85
86
  "postcss-value-parser": "^4.2.0",
86
87
  "quick-lru": "^5.1.1",