tailwindcss 3.1.7 → 3.2.0

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 (112) hide show
  1. package/README.md +12 -8
  2. package/lib/cli/build/deps.js +54 -0
  3. package/lib/cli/build/index.js +44 -0
  4. package/lib/cli/build/plugin.js +335 -0
  5. package/lib/cli/build/utils.js +78 -0
  6. package/lib/cli/build/watching.js +113 -0
  7. package/lib/cli/help/index.js +71 -0
  8. package/lib/cli/index.js +18 -0
  9. package/lib/cli/init/index.js +46 -0
  10. package/lib/cli/shared.js +12 -0
  11. package/lib/cli.js +11 -590
  12. package/lib/corePlugins.js +332 -108
  13. package/lib/css/preflight.css +5 -0
  14. package/lib/featureFlags.js +7 -4
  15. package/lib/index.js +6 -1
  16. package/lib/lib/content.js +167 -0
  17. package/lib/lib/defaultExtractor.js +15 -10
  18. package/lib/lib/detectNesting.js +2 -2
  19. package/lib/lib/evaluateTailwindFunctions.js +17 -1
  20. package/lib/lib/expandApplyAtRules.js +71 -37
  21. package/lib/lib/expandTailwindAtRules.js +10 -42
  22. package/lib/lib/findAtConfigPath.js +44 -0
  23. package/lib/lib/generateRules.js +181 -96
  24. package/lib/lib/normalizeTailwindDirectives.js +1 -1
  25. package/lib/lib/offsets.js +217 -0
  26. package/lib/lib/regex.js +1 -1
  27. package/lib/lib/setupContextUtils.js +339 -100
  28. package/lib/lib/setupTrackingContext.js +5 -39
  29. package/lib/lib/sharedState.js +2 -0
  30. package/lib/public/colors.js +1 -1
  31. package/lib/util/buildMediaQuery.js +6 -3
  32. package/lib/util/configurePlugins.js +1 -1
  33. package/lib/util/dataTypes.js +15 -19
  34. package/lib/util/formatVariantSelector.js +92 -8
  35. package/lib/util/getAllConfigs.js +14 -3
  36. package/lib/util/isValidArbitraryValue.js +1 -1
  37. package/lib/util/nameClass.js +3 -0
  38. package/lib/util/negateValue.js +15 -2
  39. package/lib/util/normalizeConfig.js +17 -3
  40. package/lib/util/normalizeScreens.js +100 -3
  41. package/lib/util/parseAnimationValue.js +1 -1
  42. package/lib/util/parseBoxShadowValue.js +1 -1
  43. package/lib/util/parseDependency.js +33 -54
  44. package/lib/util/parseGlob.js +34 -0
  45. package/lib/util/parseObjectStyles.js +1 -1
  46. package/lib/util/pluginUtils.js +86 -17
  47. package/lib/util/resolveConfig.js +3 -3
  48. package/lib/util/splitAtTopLevelOnly.js +31 -81
  49. package/lib/util/transformThemeValue.js +9 -2
  50. package/lib/util/validateConfig.js +1 -1
  51. package/lib/util/validateFormalSyntax.js +24 -0
  52. package/package.json +14 -12
  53. package/peers/.DS_Store +0 -0
  54. package/peers/.svgo.yml +75 -0
  55. package/peers/index.js +3690 -2274
  56. package/peers/orders/concentric-css.json +299 -0
  57. package/peers/orders/smacss.json +299 -0
  58. package/peers/orders/source.json +295 -0
  59. package/plugin.d.ts +3 -3
  60. package/scripts/release-channel.js +18 -0
  61. package/scripts/release-notes.js +21 -0
  62. package/src/.DS_Store +0 -0
  63. package/src/cli/build/deps.js +56 -0
  64. package/src/cli/build/index.js +45 -0
  65. package/src/cli/build/plugin.js +397 -0
  66. package/src/cli/build/utils.js +76 -0
  67. package/src/cli/build/watching.js +134 -0
  68. package/src/cli/help/index.js +70 -0
  69. package/src/cli/index.js +3 -0
  70. package/src/cli/init/index.js +50 -0
  71. package/src/cli/shared.js +5 -0
  72. package/src/cli.js +4 -696
  73. package/src/corePlugins.js +262 -39
  74. package/src/css/preflight.css +5 -0
  75. package/src/featureFlags.js +12 -2
  76. package/src/index.js +5 -0
  77. package/src/lib/content.js +205 -0
  78. package/src/lib/defaultExtractor.js +3 -0
  79. package/src/lib/evaluateTailwindFunctions.js +22 -1
  80. package/src/lib/expandApplyAtRules.js +76 -29
  81. package/src/lib/expandTailwindAtRules.js +8 -46
  82. package/src/lib/findAtConfigPath.js +48 -0
  83. package/src/lib/generateRules.js +224 -105
  84. package/src/lib/offsets.js +270 -0
  85. package/src/lib/setupContextUtils.js +376 -89
  86. package/src/lib/setupTrackingContext.js +4 -45
  87. package/src/lib/sharedState.js +2 -0
  88. package/src/util/buildMediaQuery.js +5 -3
  89. package/src/util/dataTypes.js +15 -17
  90. package/src/util/formatVariantSelector.js +113 -9
  91. package/src/util/getAllConfigs.js +14 -2
  92. package/src/util/nameClass.js +4 -0
  93. package/src/util/negateValue.js +10 -2
  94. package/src/util/normalizeConfig.js +22 -2
  95. package/src/util/normalizeScreens.js +99 -4
  96. package/src/util/parseBoxShadowValue.js +1 -1
  97. package/src/util/parseDependency.js +37 -42
  98. package/src/util/parseGlob.js +24 -0
  99. package/src/util/pluginUtils.js +90 -14
  100. package/src/util/resolveConfig.js +2 -2
  101. package/src/util/splitAtTopLevelOnly.js +23 -49
  102. package/src/util/transformThemeValue.js +9 -1
  103. package/src/util/validateFormalSyntax.js +34 -0
  104. package/stubs/defaultConfig.stub.js +19 -3
  105. package/tmp.css +11 -0
  106. package/tmp.dependency-graph.js +2 -0
  107. package/tmp.in.css +3 -0
  108. package/tmp.js +0 -0
  109. package/tmp.out.css +524 -0
  110. package/types/config.d.ts +47 -13
  111. package/types/generated/default-theme.d.ts +11 -0
  112. package/CHANGELOG.md +0 -2222
@@ -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,67 @@ 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 canUseUtilityModifier = modifiersEnabled && options.modifiers != null && (options.modifiers === "any" || typeof options.modifiers === "object");
216
+ let [modifier, utilityModifier] = canUseUtilityModifier ? splitUtilityModifier(rawModifier) : [
217
+ rawModifier,
218
+ undefined
219
+ ];
220
+ if (utilityModifier !== undefined && modifier === "") {
221
+ modifier = "DEFAULT";
222
+ }
223
+ // Check the full value first
224
+ // TODO: Move to asValue… somehow
225
+ if (utilityModifier !== undefined) {
226
+ if (typeof options.modifiers === "object") {
227
+ var ref;
228
+ var ref1;
229
+ let configValue = (ref1 = (ref = options.modifiers) === null || ref === void 0 ? void 0 : ref[utilityModifier]) !== null && ref1 !== void 0 ? ref1 : null;
230
+ if (configValue !== null) {
231
+ utilityModifier = configValue;
232
+ } else if (isArbitraryValue(utilityModifier)) {
233
+ utilityModifier = utilityModifier.slice(1, -1);
234
+ }
235
+ }
236
+ let result = asValue(rawModifier, options, {
237
+ rawModifier,
238
+ utilityModifier,
239
+ tailwindConfig
240
+ });
241
+ if (result !== undefined) {
242
+ yield [
243
+ result,
244
+ "any",
245
+ null
246
+ ];
247
+ }
248
+ }
249
+ for (const { type } of types !== null && types !== void 0 ? types : []){
250
+ let result1 = typeMap[type](modifier, options, {
251
+ rawModifier,
252
+ utilityModifier,
187
253
  tailwindConfig
188
254
  });
189
- if (result !== undefined) return [
190
- result,
191
- type
255
+ if (result1 === undefined) {
256
+ continue;
257
+ }
258
+ yield [
259
+ result1,
260
+ type,
261
+ utilityModifier !== null && utilityModifier !== void 0 ? utilityModifier : null
192
262
  ];
193
263
  }
194
- return [];
195
264
  }
@@ -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
  }
@@ -160,7 +160,7 @@ function resolveFunctionKeys(object) {
160
160
  let val = object;
161
161
  while(val !== undefined && val !== null && index < path.length){
162
162
  val = val[path[index++]];
163
- let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index < path.length - 1);
163
+ let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
164
164
  val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
165
165
  }
166
166
  if (val !== undefined) {
@@ -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.7",
3
+ "version": "3.2.0",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -26,7 +26,9 @@
26
26
  "posttest": "npm run style",
27
27
  "generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js",
28
28
  "generate:types": "node -r @swc/register scripts/generate-types.js",
29
- "generate": "npm run generate:plugin-list && npm run generate:types"
29
+ "generate": "npm run generate:plugin-list && npm run generate:types",
30
+ "release-channel": "node ./scripts/release-channel.js",
31
+ "release-notes": "node ./scripts/release-notes.js"
30
32
  },
31
33
  "files": [
32
34
  "src/*",
@@ -43,19 +45,19 @@
43
45
  ],
44
46
  "devDependencies": {
45
47
  "@swc/cli": "^0.1.57",
46
- "@swc/core": "^1.2.218",
47
- "@swc/jest": "^0.2.22",
48
+ "@swc/core": "^1.3.4",
49
+ "@swc/jest": "^0.2.23",
48
50
  "@swc/register": "^0.1.10",
49
- "autoprefixer": "^10.4.7",
50
- "cssnano": "^5.1.12",
51
- "esbuild": "^0.14.48",
52
- "eslint": "^8.19.0",
51
+ "autoprefixer": "^10.4.12",
52
+ "cssnano": "^5.1.13",
53
+ "esbuild": "^0.15.10",
54
+ "eslint": "^8.25.0",
53
55
  "eslint-config-prettier": "^8.5.0",
54
56
  "eslint-plugin-prettier": "^4.2.1",
55
57
  "jest": "^28.1.3",
56
58
  "jest-diff": "^28.1.3",
57
59
  "prettier": "^2.7.1",
58
- "prettier-plugin-tailwindcss": "^0.1.12",
60
+ "prettier-plugin-tailwindcss": "^0.1.13",
59
61
  "rimraf": "^3.0.0",
60
62
  "source-map-js": "^1.0.2"
61
63
  },
@@ -69,18 +71,18 @@
69
71
  "detective": "^5.2.1",
70
72
  "didyoumean": "^1.2.2",
71
73
  "dlv": "^1.1.3",
72
- "fast-glob": "^3.2.11",
74
+ "fast-glob": "^3.2.12",
73
75
  "glob-parent": "^6.0.2",
74
76
  "is-glob": "^4.0.3",
75
77
  "lilconfig": "^2.0.6",
76
78
  "normalize-path": "^3.0.0",
77
79
  "object-hash": "^3.0.0",
78
80
  "picocolors": "^1.0.0",
79
- "postcss": "^8.4.14",
81
+ "postcss": "^8.4.17",
80
82
  "postcss-import": "^14.1.0",
81
83
  "postcss-js": "^4.0.0",
82
84
  "postcss-load-config": "^3.1.4",
83
- "postcss-nested": "5.0.6",
85
+ "postcss-nested": "6.0.0",
84
86
  "postcss-selector-parser": "^6.0.10",
85
87
  "postcss-value-parser": "^4.2.0",
86
88
  "quick-lru": "^5.1.1",
Binary file
@@ -0,0 +1,75 @@
1
+ # replace default config
2
+
3
+ # multipass: true
4
+ # full: true
5
+
6
+ plugins:
7
+
8
+ # - name
9
+ #
10
+ # or:
11
+ # - name: false
12
+ # - name: true
13
+ #
14
+ # or:
15
+ # - name:
16
+ # param1: 1
17
+ # param2: 2
18
+
19
+ - removeDoctype
20
+ - removeXMLProcInst
21
+ - removeComments
22
+ - removeMetadata
23
+ - removeXMLNS
24
+ - removeEditorsNSData
25
+ - cleanupAttrs
26
+ - inlineStyles
27
+ - minifyStyles
28
+ - convertStyleToAttrs
29
+ - cleanupIDs
30
+ - prefixIds
31
+ - removeRasterImages
32
+ - removeUselessDefs
33
+ - cleanupNumericValues
34
+ - cleanupListOfValues
35
+ - convertColors
36
+ - removeUnknownsAndDefaults
37
+ - removeNonInheritableGroupAttrs
38
+ - removeUselessStrokeAndFill
39
+ - removeViewBox
40
+ - cleanupEnableBackground
41
+ - removeHiddenElems
42
+ - removeEmptyText
43
+ - convertShapeToPath
44
+ - convertEllipseToCircle
45
+ - moveElemsAttrsToGroup
46
+ - moveGroupAttrsToElems
47
+ - collapseGroups
48
+ - convertPathData
49
+ - convertTransform
50
+ - removeEmptyAttrs
51
+ - removeEmptyContainers
52
+ - mergePaths
53
+ - removeUnusedNS
54
+ - sortAttrs
55
+ - sortDefsChildren
56
+ - removeTitle
57
+ - removeDesc
58
+ - removeDimensions
59
+ - removeAttrs
60
+ - removeAttributesBySelector
61
+ - removeElementsByAttr
62
+ - addClassesToSVGElement
63
+ - removeStyleElement
64
+ - removeScriptElement
65
+ - addAttributesToSVGElement
66
+ - removeOffCanvasPaths
67
+ - reusePaths
68
+
69
+ # configure the indent (default 4 spaces) used by `--pretty` here:
70
+ #
71
+ # @see https://github.com/svg/svgo/blob/master/lib/svgo/js2svg.js#L6 for more config options
72
+ #
73
+ # js2svg:
74
+ # pretty: true
75
+ # indent: ' '