tailwindcss 0.0.0-insiders.ba2fd32 → 0.0.0-insiders.bbafc8e

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 (106) hide show
  1. package/CHANGELOG.md +292 -3
  2. package/LICENSE +1 -2
  3. package/README.md +8 -4
  4. package/colors.js +2 -1
  5. package/defaultConfig.js +2 -1
  6. package/defaultTheme.js +2 -1
  7. package/lib/cli.js +96 -61
  8. package/lib/constants.js +1 -1
  9. package/lib/corePluginList.js +4 -0
  10. package/lib/corePlugins.js +399 -374
  11. package/lib/css/preflight.css +6 -5
  12. package/lib/featureFlags.js +7 -8
  13. package/lib/index.js +12 -3
  14. package/lib/lib/cacheInvalidation.js +69 -0
  15. package/lib/lib/collapseAdjacentRules.js +14 -1
  16. package/lib/lib/collapseDuplicateDeclarations.js +54 -3
  17. package/lib/lib/defaultExtractor.js +44 -0
  18. package/lib/lib/detectNesting.js +17 -2
  19. package/lib/lib/evaluateTailwindFunctions.js +10 -6
  20. package/lib/lib/expandApplyAtRules.js +264 -59
  21. package/lib/lib/expandTailwindAtRules.js +63 -46
  22. package/lib/lib/generateRules.js +181 -43
  23. package/lib/lib/normalizeTailwindDirectives.js +10 -2
  24. package/lib/lib/partitionApplyAtRules.js +53 -0
  25. package/lib/lib/resolveDefaultsAtRules.js +32 -14
  26. package/lib/lib/setupContextUtils.js +152 -153
  27. package/lib/lib/setupTrackingContext.js +8 -7
  28. package/lib/lib/sharedState.js +38 -5
  29. package/lib/lib/substituteScreenAtRules.js +7 -4
  30. package/{nesting → lib/postcss-plugins/nesting}/README.md +0 -0
  31. package/lib/postcss-plugins/nesting/index.js +17 -0
  32. package/lib/postcss-plugins/nesting/plugin.js +85 -0
  33. package/lib/processTailwindFeatures.js +10 -2
  34. package/lib/util/buildMediaQuery.js +13 -24
  35. package/lib/util/cloneNodes.js +12 -1
  36. package/lib/util/color.js +23 -8
  37. package/lib/util/createPlugin.js +1 -2
  38. package/lib/util/createUtilityPlugin.js +6 -10
  39. package/lib/util/dataTypes.js +25 -3
  40. package/lib/util/defaults.js +6 -0
  41. package/lib/util/flattenColorPalette.js +1 -3
  42. package/lib/util/formatVariantSelector.js +93 -9
  43. package/lib/util/isValidArbitraryValue.js +64 -0
  44. package/lib/util/log.js +10 -6
  45. package/lib/util/nameClass.js +1 -0
  46. package/lib/util/normalizeConfig.js +54 -22
  47. package/lib/util/normalizeScreens.js +59 -0
  48. package/lib/util/parseBoxShadowValue.js +117 -0
  49. package/lib/util/pluginUtils.js +18 -24
  50. package/lib/util/prefixSelector.js +4 -5
  51. package/lib/util/resolveConfig.js +52 -31
  52. package/lib/util/resolveConfigPath.js +1 -2
  53. package/lib/util/toColorValue.js +1 -2
  54. package/lib/util/toPath.js +6 -1
  55. package/lib/util/transformThemeValue.js +4 -8
  56. package/nesting/index.js +2 -12
  57. package/package.json +28 -33
  58. package/peers/index.js +6970 -7268
  59. package/plugin.js +2 -1
  60. package/resolveConfig.js +2 -1
  61. package/src/cli.js +62 -15
  62. package/src/corePluginList.js +1 -1
  63. package/src/corePlugins.js +329 -255
  64. package/src/css/preflight.css +6 -5
  65. package/src/featureFlags.js +3 -3
  66. package/src/index.js +14 -6
  67. package/src/lib/cacheInvalidation.js +52 -0
  68. package/src/lib/collapseAdjacentRules.js +16 -1
  69. package/src/lib/collapseDuplicateDeclarations.js +66 -1
  70. package/src/lib/defaultExtractor.js +50 -0
  71. package/src/lib/detectNesting.js +22 -3
  72. package/src/lib/evaluateTailwindFunctions.js +6 -3
  73. package/src/lib/expandApplyAtRules.js +285 -56
  74. package/src/lib/expandTailwindAtRules.js +75 -35
  75. package/src/lib/generateRules.js +154 -26
  76. package/src/lib/normalizeTailwindDirectives.js +7 -1
  77. package/src/lib/partitionApplyAtRules.js +52 -0
  78. package/src/lib/resolveDefaultsAtRules.js +35 -10
  79. package/src/lib/setupContextUtils.js +133 -103
  80. package/src/lib/setupTrackingContext.js +8 -7
  81. package/src/lib/sharedState.js +42 -4
  82. package/src/lib/substituteScreenAtRules.js +6 -3
  83. package/src/postcss-plugins/nesting/README.md +42 -0
  84. package/src/postcss-plugins/nesting/index.js +13 -0
  85. package/src/postcss-plugins/nesting/plugin.js +80 -0
  86. package/src/processTailwindFeatures.js +12 -2
  87. package/src/util/buildMediaQuery.js +14 -18
  88. package/src/util/cloneNodes.js +14 -1
  89. package/src/util/color.js +20 -7
  90. package/src/util/dataTypes.js +24 -6
  91. package/src/util/defaults.js +6 -0
  92. package/src/util/formatVariantSelector.js +92 -1
  93. package/src/util/isValidArbitraryValue.js +61 -0
  94. package/src/util/log.js +10 -6
  95. package/src/util/nameClass.js +1 -1
  96. package/src/util/normalizeConfig.js +24 -3
  97. package/src/util/normalizeScreens.js +45 -0
  98. package/src/util/parseBoxShadowValue.js +119 -0
  99. package/src/util/pluginUtils.js +3 -1
  100. package/src/util/prefixSelector.js +7 -5
  101. package/src/util/resolveConfig.js +41 -1
  102. package/src/util/toPath.js +23 -1
  103. package/stubs/defaultConfig.stub.js +27 -11
  104. package/lib/lib/setupWatchingContext.js +0 -288
  105. package/nesting/plugin.js +0 -41
  106. package/src/lib/setupWatchingContext.js +0 -311
@@ -3,11 +3,27 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.normalizeConfig = normalizeConfig;
6
- var _log = _interopRequireDefault(require("./log"));
7
- function _interopRequireDefault(obj) {
8
- return obj && obj.__esModule ? obj : {
9
- default: obj
10
- };
6
+ var _log = _interopRequireWildcard(require("./log"));
7
+ function _interopRequireWildcard(obj) {
8
+ if (obj && obj.__esModule) {
9
+ return obj;
10
+ } else {
11
+ var newObj = {};
12
+ if (obj != null) {
13
+ for(var key in obj){
14
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
15
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
16
+ if (desc.get || desc.set) {
17
+ Object.defineProperty(newObj, key, desc);
18
+ } else {
19
+ newObj[key] = obj[key];
20
+ }
21
+ }
22
+ }
23
+ }
24
+ newObj.default = obj;
25
+ return newObj;
26
+ }
11
27
  }
12
28
  function normalizeConfig(config) {
13
29
  // Quick structure validation
@@ -107,7 +123,8 @@ function normalizeConfig(config) {
107
123
  if (!valid) {
108
124
  _log.default.warn('purge-deprecation', [
109
125
  'The `purge`/`content` options have changed in Tailwind CSS v3.0.',
110
- 'Update your configuration file to eliminate this warning.'
126
+ 'Update your configuration file to eliminate this warning.',
127
+ 'https://tailwindcss.com/docs/upgrade-guide#configure-content-sources',
111
128
  ]);
112
129
  }
113
130
  // Normalize the `safelist`
@@ -124,7 +141,8 @@ function normalizeConfig(config) {
124
141
  if (typeof config.prefix === 'function') {
125
142
  _log.default.warn('prefix-function', [
126
143
  'As of Tailwind CSS v3.0, `prefix` cannot be a function.',
127
- 'Update `prefix` in your configuration to be a string to eliminate this warning.'
144
+ 'Update `prefix` in your configuration to be a string to eliminate this warning.',
145
+ 'https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function',
128
146
  ]);
129
147
  config.prefix = '';
130
148
  } else {
@@ -151,17 +169,15 @@ function normalizeConfig(config) {
151
169
  if ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.extract) === null || ref5 === void 0 ? void 0 : ref5.DEFAULT) return config.content.extract.DEFAULT;
152
170
  if ((ref6 = config.purge) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.options) === null || ref7 === void 0 ? void 0 : ref7.extractors) return config.purge.options.extractors;
153
171
  if ((ref8 = config.content) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.options) === null || ref9 === void 0 ? void 0 : ref9.extractors) return config.content.options.extractors;
154
- return {
155
- };
172
+ return {};
156
173
  })();
157
- let extractors = {
158
- };
174
+ let extractors = {};
159
175
  let defaultExtractor = (()=>{
160
- var ref, ref46, ref47, ref48;
161
- if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref46 = ref.options) === null || ref46 === void 0 ? void 0 : ref46.defaultExtractor) {
176
+ var ref, ref10, ref11, ref12;
177
+ if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref10 = ref.options) === null || ref10 === void 0 ? void 0 : ref10.defaultExtractor) {
162
178
  return config.purge.options.defaultExtractor;
163
179
  }
164
- if ((ref47 = config.content) === null || ref47 === void 0 ? void 0 : (ref48 = ref47.options) === null || ref48 === void 0 ? void 0 : ref48.defaultExtractor) {
180
+ if ((ref11 = config.content) === null || ref11 === void 0 ? void 0 : (ref12 = ref11.options) === null || ref12 === void 0 ? void 0 : ref12.defaultExtractor) {
165
181
  return config.content.options.defaultExtractor;
166
182
  }
167
183
  return undefined;
@@ -185,16 +201,14 @@ function normalizeConfig(config) {
185
201
  })(),
186
202
  transform: (()=>{
187
203
  let transform = (()=>{
188
- var ref, ref61, ref62, ref63, ref64, ref65;
204
+ var ref, ref13, ref14, ref15, ref16, ref17;
189
205
  if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.transform) return config.purge.transform;
190
- if ((ref61 = config.content) === null || ref61 === void 0 ? void 0 : ref61.transform) return config.content.transform;
191
- if ((ref62 = config.purge) === null || ref62 === void 0 ? void 0 : (ref63 = ref62.transform) === null || ref63 === void 0 ? void 0 : ref63.DEFAULT) return config.purge.transform.DEFAULT;
192
- if ((ref64 = config.content) === null || ref64 === void 0 ? void 0 : (ref65 = ref64.transform) === null || ref65 === void 0 ? void 0 : ref65.DEFAULT) return config.content.transform.DEFAULT;
193
- return {
194
- };
206
+ if ((ref13 = config.content) === null || ref13 === void 0 ? void 0 : ref13.transform) return config.content.transform;
207
+ if ((ref14 = config.purge) === null || ref14 === void 0 ? void 0 : (ref15 = ref14.transform) === null || ref15 === void 0 ? void 0 : ref15.DEFAULT) return config.purge.transform.DEFAULT;
208
+ if ((ref16 = config.content) === null || ref16 === void 0 ? void 0 : (ref17 = ref16.transform) === null || ref17 === void 0 ? void 0 : ref17.DEFAULT) return config.content.transform.DEFAULT;
209
+ return {};
195
210
  })();
196
- let transformers = {
197
- };
211
+ let transformers = {};
198
212
  if (typeof transform === 'function') {
199
213
  transformers.DEFAULT = transform;
200
214
  }
@@ -204,5 +218,23 @@ function normalizeConfig(config) {
204
218
  return transformers;
205
219
  })()
206
220
  };
221
+ // Validate globs to prevent bogus globs.
222
+ // E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
223
+ for (let file of config.content.files){
224
+ if (typeof file === 'string' && /{([^,]*?)}/g.test(file)) {
225
+ _log.default.warn('invalid-glob-braces', [
226
+ `The glob pattern ${(0, _log).dim(file)} in your Tailwind CSS configuration is invalid.`,
227
+ `Update it to ${(0, _log).dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`
228
+ ]);
229
+ break;
230
+ }
231
+ }
232
+ if (config.content.files.length === 0) {
233
+ _log.default.warn('content-problems', [
234
+ 'The `content` option in your Tailwind CSS configuration is missing or empty.',
235
+ 'Configure your content sources or your generated CSS will be missing styles.',
236
+ 'https://tailwindcss.com/docs/content-configuration',
237
+ ]);
238
+ }
207
239
  return config;
208
240
  }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.normalizeScreens = normalizeScreens;
6
+ function normalizeScreens(screens, root = true) {
7
+ if (Array.isArray(screens)) {
8
+ return screens.map((screen)=>{
9
+ if (root && Array.isArray(screen)) {
10
+ throw new Error('The tuple syntax is not supported for `screens`.');
11
+ }
12
+ if (typeof screen === 'string') {
13
+ return {
14
+ name: screen.toString(),
15
+ values: [
16
+ {
17
+ min: screen,
18
+ max: undefined
19
+ }
20
+ ]
21
+ };
22
+ }
23
+ let [name, options] = screen;
24
+ name = name.toString();
25
+ if (typeof options === 'string') {
26
+ return {
27
+ name,
28
+ values: [
29
+ {
30
+ min: options,
31
+ max: undefined
32
+ }
33
+ ]
34
+ };
35
+ }
36
+ if (Array.isArray(options)) {
37
+ return {
38
+ name,
39
+ values: options.map((option)=>resolveValue(option)
40
+ )
41
+ };
42
+ }
43
+ return {
44
+ name,
45
+ values: [
46
+ resolveValue(options)
47
+ ]
48
+ };
49
+ });
50
+ }
51
+ return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
52
+ }
53
+ function resolveValue({ 'min-width': _minWidth , min =_minWidth , max , raw } = {}) {
54
+ return {
55
+ min,
56
+ max,
57
+ raw
58
+ };
59
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.parseBoxShadowValue = parseBoxShadowValue;
6
+ exports.formatBoxShadowValue = formatBoxShadowValue;
7
+ let KEYWORDS = new Set([
8
+ 'inset',
9
+ 'inherit',
10
+ 'initial',
11
+ 'revert',
12
+ 'unset'
13
+ ]);
14
+ let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
15
+ ;
16
+ let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
17
+ let SPECIALS = /[(),]/g;
18
+ /**
19
+ * This splits a string on top-level commas.
20
+ *
21
+ * Regex doesn't support recursion (at least not the JS-flavored version).
22
+ * So we have to use a tiny state machine to keep track of paren vs comma
23
+ * placement. Before we'd only exclude commas from the inner-most nested
24
+ * set of parens rather than any commas that were not contained in parens
25
+ * at all which is the intended behavior here.
26
+ *
27
+ * Expected behavior:
28
+ * var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
29
+ * ─┬─ ┬ ┬ ┬
30
+ * x x x ╰──────── Split because top-level
31
+ * ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
32
+ *
33
+ * @param {string} input
34
+ */ function* splitByTopLevelCommas(input) {
35
+ SPECIALS.lastIndex = -1;
36
+ let depth = 0;
37
+ let lastIndex = 0;
38
+ let found = false;
39
+ // Find all parens & commas
40
+ // And only split on commas if they're top-level
41
+ for (let match of input.matchAll(SPECIALS)){
42
+ if (match[0] === '(') depth++;
43
+ if (match[0] === ')') depth--;
44
+ if (match[0] === ',' && depth === 0) {
45
+ found = true;
46
+ yield input.substring(lastIndex, match.index);
47
+ lastIndex = match.index + match[0].length;
48
+ }
49
+ }
50
+ // Provide the last segment of the string if available
51
+ // Otherwise the whole string since no commas were found
52
+ // This mirrors the behavior of string.split()
53
+ if (found) {
54
+ yield input.substring(lastIndex);
55
+ } else {
56
+ yield input;
57
+ }
58
+ }
59
+ function parseBoxShadowValue(input) {
60
+ let shadows = Array.from(splitByTopLevelCommas(input));
61
+ return shadows.map((shadow)=>{
62
+ let value = shadow.trim();
63
+ let result = {
64
+ raw: value
65
+ };
66
+ let parts = value.split(SPACE);
67
+ let seen = new Set();
68
+ for (let part of parts){
69
+ // Reset index, since the regex is stateful.
70
+ LENGTH.lastIndex = 0;
71
+ // Keyword
72
+ if (!seen.has('KEYWORD') && KEYWORDS.has(part)) {
73
+ result.keyword = part;
74
+ seen.add('KEYWORD');
75
+ } else if (LENGTH.test(part)) {
76
+ if (!seen.has('X')) {
77
+ result.x = part;
78
+ seen.add('X');
79
+ } else if (!seen.has('Y')) {
80
+ result.y = part;
81
+ seen.add('Y');
82
+ } else if (!seen.has('BLUR')) {
83
+ result.blur = part;
84
+ seen.add('BLUR');
85
+ } else if (!seen.has('SPREAD')) {
86
+ result.spread = part;
87
+ seen.add('SPREAD');
88
+ }
89
+ } else {
90
+ if (!result.color) {
91
+ result.color = part;
92
+ } else {
93
+ if (!result.unknown) result.unknown = [];
94
+ result.unknown.push(part);
95
+ }
96
+ }
97
+ }
98
+ // Check if valid
99
+ result.valid = result.x !== undefined && result.y !== undefined;
100
+ return result;
101
+ });
102
+ }
103
+ function formatBoxShadowValue(shadows) {
104
+ return shadows.map((shadow)=>{
105
+ if (!shadow.valid) {
106
+ return shadow.raw;
107
+ }
108
+ return [
109
+ shadow.keyword,
110
+ shadow.x,
111
+ shadow.y,
112
+ shadow.blur,
113
+ shadow.spread,
114
+ shadow.color
115
+ ].filter(Boolean).join(' ');
116
+ }).join(', ');
117
+ }
@@ -17,7 +17,7 @@ function _interopRequireDefault(obj) {
17
17
  default: obj
18
18
  };
19
19
  }
20
- function updateAllClasses(selectors, updateClass) {
20
+ function updateAllClasses(selectors1, updateClass) {
21
21
  let parser = (0, _postcssSelectorParser).default((selectors)=>{
22
22
  selectors.walkClasses((sel)=>{
23
23
  let updatedClass = updateClass(sel.value);
@@ -27,7 +27,7 @@ function updateAllClasses(selectors, updateClass) {
27
27
  }
28
28
  });
29
29
  });
30
- let result = parser.processSync(selectors);
30
+ let result = parser.processSync(selectors1);
31
31
  return result;
32
32
  }
33
33
  function resolveArbitraryValue(modifier, validate) {
@@ -40,8 +40,7 @@ function resolveArbitraryValue(modifier, validate) {
40
40
  }
41
41
  return (0, _dataTypes).normalize(value);
42
42
  }
43
- function asNegativeValue(modifier, lookup = {
44
- }, validate) {
43
+ function asNegativeValue(modifier, lookup = {}, validate) {
45
44
  let positiveValue = lookup[modifier];
46
45
  if (positiveValue !== undefined) {
47
46
  return (0, _negateValue).default(positiveValue);
@@ -54,10 +53,8 @@ function asNegativeValue(modifier, lookup = {
54
53
  return (0, _negateValue).default(resolved);
55
54
  }
56
55
  }
57
- function asValue(modifier, options = {
58
- }, { validate =()=>true
59
- } = {
60
- }) {
56
+ function asValue(modifier, options = {}, { validate =()=>true
57
+ } = {}) {
61
58
  var ref;
62
59
  let value = (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
63
60
  if (value !== undefined) {
@@ -83,27 +80,24 @@ function splitAlpha(modifier) {
83
80
  modifier.slice(slashIdx + 1)
84
81
  ];
85
82
  }
86
- function asColor(modifier, options = {
87
- }, { tailwindConfig ={
88
- } } = {
89
- }) {
90
- var ref7;
91
- if (((ref7 = options.values) === null || ref7 === void 0 ? void 0 : ref7[modifier]) !== undefined) {
92
- var ref;
93
- return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
83
+ function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
84
+ var ref;
85
+ if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
86
+ var ref1;
87
+ return (ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier];
94
88
  }
95
89
  let [color, alpha] = splitAlpha(modifier);
96
90
  if (alpha !== undefined) {
97
- var ref, ref1, ref2;
98
- var ref3;
99
- let normalizedColor = (ref3 = (ref = options.values) === null || ref === void 0 ? void 0 : ref[color]) !== null && ref3 !== void 0 ? ref3 : isArbitraryValue(color) ? color.slice(1, -1) : undefined;
91
+ var ref2, ref3, ref4;
92
+ var ref5;
93
+ let normalizedColor = (ref5 = (ref2 = options.values) === null || ref2 === void 0 ? void 0 : ref2[color]) !== null && ref5 !== void 0 ? ref5 : isArbitraryValue(color) ? color.slice(1, -1) : undefined;
100
94
  if (normalizedColor === undefined) {
101
95
  return undefined;
102
96
  }
103
97
  if (isArbitraryValue(alpha)) {
104
98
  return (0, _withAlphaVariable).withAlphaValue(normalizedColor, alpha.slice(1, -1));
105
99
  }
106
- if (((ref1 = tailwindConfig.theme) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.opacity) === null || ref2 === void 0 ? void 0 : ref2[alpha]) === undefined) {
100
+ if (((ref3 = tailwindConfig.theme) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.opacity) === null || ref4 === void 0 ? void 0 : ref4[alpha]) === undefined) {
107
101
  return undefined;
108
102
  }
109
103
  return (0, _withAlphaVariable).withAlphaValue(normalizedColor, tailwindConfig.theme.opacity[alpha]);
@@ -112,8 +106,7 @@ function asColor(modifier, options = {
112
106
  validate: _dataTypes.color
113
107
  });
114
108
  }
115
- function asLookupValue(modifier, options = {
116
- }) {
109
+ function asLookupValue(modifier, options = {}) {
117
110
  var ref;
118
111
  return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
119
112
  }
@@ -138,7 +131,8 @@ let typeMap = {
138
131
  number: guess(_dataTypes.number),
139
132
  'line-width': guess(_dataTypes.lineWidth),
140
133
  'absolute-size': guess(_dataTypes.absoluteSize),
141
- 'relative-size': guess(_dataTypes.relativeSize)
134
+ 'relative-size': guess(_dataTypes.relativeSize),
135
+ shadow: guess(_dataTypes.shadow)
142
136
  };
143
137
  let supportedTypes = Object.keys(typeMap);
144
138
  function splitAtFirst(input, delim) {
@@ -176,7 +170,7 @@ function coerceValue(types, modifier, options, tailwindConfig) {
176
170
  let result = typeMap[type](modifier, options, {
177
171
  tailwindConfig
178
172
  });
179
- if (result) return [
173
+ if (result !== undefined) return [
180
174
  result,
181
175
  type
182
176
  ];
@@ -4,18 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = _default;
6
6
  var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
7
- var _tap = require("./tap");
8
7
  function _interopRequireDefault(obj) {
9
8
  return obj && obj.__esModule ? obj : {
10
9
  default: obj
11
10
  };
12
11
  }
13
- function _default(prefix, selector) {
12
+ function _default(prefix, selector, prependNegative = false) {
14
13
  return (0, _postcssSelectorParser).default((selectors)=>{
15
14
  selectors.walkClasses((classSelector)=>{
16
- (0, _tap).tap(classSelector.value, (baseClass)=>{
17
- classSelector.value = `${prefix}${baseClass}`;
18
- });
15
+ let baseClass = classSelector.value;
16
+ let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith('-');
17
+ classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
19
18
  });
20
19
  }).processSync(selector);
21
20
  }
@@ -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
@@ -51,8 +53,7 @@ const configUtils = {
51
53
  negativeScale[`-${key}`] = negativeValue;
52
54
  }
53
55
  return negativeScale;
54
- }, {
55
- });
56
+ }, {});
56
57
  },
57
58
  breakpoints (screens) {
58
59
  return Object.keys(screens).filter((key)=>typeof screens[key] === 'string'
@@ -60,8 +61,29 @@ const configUtils = {
60
61
  ...breakpoints,
61
62
  [`screen-${key}`]: screens[key]
62
63
  })
63
- , {
64
- });
64
+ , {});
65
+ },
66
+ rgb (property) {
67
+ if (!property.startsWith('--')) {
68
+ throw new Error('The rgb() helper requires a custom property name to be passed as the first argument.');
69
+ }
70
+ return ({ opacityValue })=>{
71
+ if (opacityValue === undefined || opacityValue === 1) {
72
+ return `rgb(var(${property}) / 1.0)`;
73
+ }
74
+ return `rgb(var(${property}) / ${opacityValue})`;
75
+ };
76
+ },
77
+ hsl (property) {
78
+ if (!property.startsWith('--')) {
79
+ throw new Error('The hsl() helper requires a custom property name to be passed as the first argument.');
80
+ }
81
+ return ({ opacityValue })=>{
82
+ if (opacityValue === undefined || opacityValue === 1) {
83
+ return `hsl(var(${property}) / 1)`;
84
+ }
85
+ return `hsl(var(${property}) / ${opacityValue})`;
86
+ };
65
87
  }
66
88
  };
67
89
  function value(valueToResolve, ...args) {
@@ -86,34 +108,32 @@ function collectExtends(items) {
86
108
  mergedValue
87
109
  ];
88
110
  });
89
- }, {
90
- });
111
+ }, {});
91
112
  }
92
113
  function mergeThemes(themes) {
93
114
  return {
94
115
  ...themes.reduce((merged, theme)=>(0, _defaults).defaults(merged, theme)
95
- , {
96
- }),
116
+ , {}),
97
117
  // In order to resolve n config objects, we combine all of their `extend` properties
98
118
  // into arrays instead of objects so they aren't overridden.
99
119
  extend: collectExtends(themes)
100
120
  };
101
121
  }
102
- function mergeExtensionCustomizer(merged, value) {
122
+ function mergeExtensionCustomizer(merged, value1) {
103
123
  // When we have an array of objects, we do want to merge it
104
124
  if (Array.isArray(merged) && isObject(merged[0])) {
105
- return merged.concat(value);
125
+ return merged.concat(value1);
106
126
  }
107
127
  // When the incoming value is an array, and the existing config is an object, prepend the existing object
108
- if (Array.isArray(value) && isObject(value[0]) && isObject(merged)) {
128
+ if (Array.isArray(value1) && isObject(value1[0]) && isObject(merged)) {
109
129
  return [
110
130
  merged,
111
- ...value
131
+ ...value1
112
132
  ];
113
133
  }
114
134
  // Override arrays (for example for font-families, box-shadows, ...)
115
- if (Array.isArray(value)) {
116
- return value;
135
+ if (Array.isArray(value1)) {
136
+ return value1;
117
137
  }
118
138
  // Execute default behaviour
119
139
  return undefined;
@@ -122,11 +142,9 @@ function mergeExtensions({ extend , ...theme }) {
122
142
  return mergeWith(theme, extend, (themeValue, extensions)=>{
123
143
  // The `extend` property is an array, so we need to check if it contains any functions
124
144
  if (!isFunction(themeValue) && !extensions.some(isFunction)) {
125
- return mergeWith({
126
- }, themeValue, ...extensions, mergeExtensionCustomizer);
145
+ return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
127
146
  }
128
- return (resolveThemePath, utils)=>mergeWith({
129
- }, ...[
147
+ return (resolveThemePath, utils)=>mergeWith({}, ...[
130
148
  themeValue,
131
149
  ...extensions
132
150
  ].map((e)=>value(e, resolveThemePath, utils)
@@ -143,19 +161,24 @@ function resolveFunctionKeys(object) {
143
161
  val = val[path[index++]];
144
162
  val = isFunction(val) ? val(resolvePath, configUtils) : val;
145
163
  }
146
- return val === undefined ? defaultValue : val;
164
+ if (val === undefined) {
165
+ return defaultValue;
166
+ }
167
+ if ((0, _isPlainObject).default(val)) {
168
+ return (0, _cloneDeep).cloneDeep(val);
169
+ }
170
+ return val;
147
171
  };
148
172
  resolvePath.theme = resolvePath;
149
- for(let key in configUtils){
150
- resolvePath[key] = configUtils[key];
173
+ for(let key1 in configUtils){
174
+ resolvePath[key1] = configUtils[key1];
151
175
  }
152
176
  return Object.keys(object).reduce((resolved, key)=>{
153
177
  return {
154
178
  ...resolved,
155
179
  [key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
156
180
  };
157
- }, {
158
- });
181
+ }, {});
159
182
  }
160
183
  function extractPluginConfigs(configs) {
161
184
  let allConfigs = [];
@@ -164,8 +187,8 @@ function extractPluginConfigs(configs) {
164
187
  ...allConfigs,
165
188
  config
166
189
  ];
167
- var ref;
168
- const plugins = (ref = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref !== void 0 ? ref : [];
190
+ var ref1;
191
+ const plugins = (ref1 = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref1 !== void 0 ? ref1 : [];
169
192
  if (plugins.length === 0) {
170
193
  return;
171
194
  }
@@ -177,8 +200,7 @@ function extractPluginConfigs(configs) {
177
200
  allConfigs = [
178
201
  ...allConfigs,
179
202
  ...extractPluginConfigs([
180
- (ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {
181
- }
203
+ (ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
182
204
  ])
183
205
  ];
184
206
  });
@@ -219,16 +241,15 @@ function resolveConfig(configs) {
219
241
  variantOrder: _defaultConfigStub.default.variantOrder
220
242
  },
221
243
  ];
222
- var ref, ref1;
244
+ var ref, ref2;
223
245
  return (0, _normalizeConfig).normalizeConfig((0, _defaults).defaults({
224
246
  theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
225
- return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
226
- };
247
+ return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
227
248
  })))),
228
249
  corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
229
250
  )),
230
251
  plugins: resolvePluginLists(configs.map((c)=>{
231
- return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
252
+ return (ref2 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref2 !== void 0 ? ref2 : [];
232
253
  }))
233
254
  }, ...allConfigs));
234
255
  }
@@ -45,8 +45,7 @@ function resolveConfigPath(pathOrConfig) {
45
45
  const configPath = _path.default.resolve(configFile);
46
46
  _fs.default.accessSync(configPath);
47
47
  return configPath;
48
- } catch (err) {
49
- }
48
+ } catch (err) {}
50
49
  }
51
50
  return null;
52
51
  }
@@ -4,6 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = toColorValue;
6
6
  function toColorValue(maybeFunction) {
7
- return typeof maybeFunction === 'function' ? maybeFunction({
8
- }) : maybeFunction;
7
+ return typeof maybeFunction === 'function' ? maybeFunction({}) : maybeFunction;
9
8
  }
@@ -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
  }