tailwindcss 3.0.12 → 3.0.13
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 +12 -5
- package/lib/cli.js +8 -16
- package/lib/corePlugins.js +69 -138
- package/lib/featureFlags.js +1 -2
- package/lib/lib/expandTailwindAtRules.js +2 -4
- package/lib/lib/generateRules.js +1 -2
- package/lib/lib/partitionApplyAtRules.js +53 -0
- package/lib/lib/setupContextUtils.js +52 -118
- package/lib/processTailwindFeatures.js +2 -0
- package/lib/util/createPlugin.js +1 -2
- package/lib/util/createUtilityPlugin.js +4 -8
- package/lib/util/flattenColorPalette.js +1 -3
- package/lib/util/normalizeConfig.js +6 -12
- package/lib/util/normalizeScreens.js +2 -4
- package/lib/util/pluginUtils.js +5 -12
- package/lib/util/resolveConfig.js +9 -18
- package/lib/util/resolveConfigPath.js +1 -2
- package/lib/util/toColorValue.js +1 -2
- package/lib/util/transformThemeValue.js +4 -8
- package/package.json +5 -7
- package/peers/index.js +46 -45
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/setupContextUtils.js +5 -74
- package/src/processTailwindFeatures.js +2 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.default = expandApplyAtRules;
|
|
6
|
+
function partitionRules(root) {
|
|
7
|
+
if (!root.walkAtRules) return;
|
|
8
|
+
let applyParents = new Set();
|
|
9
|
+
root.walkAtRules('apply', (rule)=>{
|
|
10
|
+
applyParents.add(rule.parent);
|
|
11
|
+
});
|
|
12
|
+
if (applyParents.size === 0) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
for (let rule1 of applyParents){
|
|
16
|
+
let nodeGroups = [];
|
|
17
|
+
let lastGroup = [];
|
|
18
|
+
for (let node of rule1.nodes){
|
|
19
|
+
if (node.type === 'atrule' && node.name === 'apply') {
|
|
20
|
+
if (lastGroup.length > 0) {
|
|
21
|
+
nodeGroups.push(lastGroup);
|
|
22
|
+
lastGroup = [];
|
|
23
|
+
}
|
|
24
|
+
nodeGroups.push([
|
|
25
|
+
node
|
|
26
|
+
]);
|
|
27
|
+
} else {
|
|
28
|
+
lastGroup.push(node);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (lastGroup.length > 0) {
|
|
32
|
+
nodeGroups.push(lastGroup);
|
|
33
|
+
}
|
|
34
|
+
if (nodeGroups.length === 1) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
for (let group of [
|
|
38
|
+
...nodeGroups
|
|
39
|
+
].reverse()){
|
|
40
|
+
let clone = rule1.clone({
|
|
41
|
+
nodes: []
|
|
42
|
+
});
|
|
43
|
+
clone.append(group);
|
|
44
|
+
rule1.after(clone);
|
|
45
|
+
}
|
|
46
|
+
rule1.remove();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function expandApplyAtRules() {
|
|
50
|
+
return (root)=>{
|
|
51
|
+
partitionRules(root);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -33,13 +33,11 @@ function _interopRequireWildcard(obj) {
|
|
|
33
33
|
if (obj && obj.__esModule) {
|
|
34
34
|
return obj;
|
|
35
35
|
} else {
|
|
36
|
-
var newObj = {
|
|
37
|
-
};
|
|
36
|
+
var newObj = {};
|
|
38
37
|
if (obj != null) {
|
|
39
38
|
for(var key in obj){
|
|
40
39
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
41
|
-
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
|
|
42
|
-
};
|
|
40
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
43
41
|
if (desc.get || desc.set) {
|
|
44
42
|
Object.defineProperty(newObj, key, desc);
|
|
45
43
|
} else {
|
|
@@ -52,55 +50,6 @@ function _interopRequireWildcard(obj) {
|
|
|
52
50
|
return newObj;
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
|
-
function partitionRules(root) {
|
|
56
|
-
if (!root.walkAtRules) return [
|
|
57
|
-
root
|
|
58
|
-
];
|
|
59
|
-
let applyParents = new Set();
|
|
60
|
-
let rules = [];
|
|
61
|
-
root.walkAtRules('apply', (rule)=>{
|
|
62
|
-
applyParents.add(rule.parent);
|
|
63
|
-
});
|
|
64
|
-
if (applyParents.size === 0) {
|
|
65
|
-
rules.push(root);
|
|
66
|
-
}
|
|
67
|
-
for (let rule1 of applyParents){
|
|
68
|
-
let nodeGroups = [];
|
|
69
|
-
let lastGroup = [];
|
|
70
|
-
for (let node of rule1.nodes){
|
|
71
|
-
if (node.type === 'atrule' && node.name === 'apply') {
|
|
72
|
-
if (lastGroup.length > 0) {
|
|
73
|
-
nodeGroups.push(lastGroup);
|
|
74
|
-
lastGroup = [];
|
|
75
|
-
}
|
|
76
|
-
nodeGroups.push([
|
|
77
|
-
node
|
|
78
|
-
]);
|
|
79
|
-
} else {
|
|
80
|
-
lastGroup.push(node);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (lastGroup.length > 0) {
|
|
84
|
-
nodeGroups.push(lastGroup);
|
|
85
|
-
}
|
|
86
|
-
if (nodeGroups.length === 1) {
|
|
87
|
-
rules.push(rule1);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
for (let group of [
|
|
91
|
-
...nodeGroups
|
|
92
|
-
].reverse()){
|
|
93
|
-
let clone = rule1.clone({
|
|
94
|
-
nodes: []
|
|
95
|
-
});
|
|
96
|
-
clone.append(group);
|
|
97
|
-
rules.unshift(clone);
|
|
98
|
-
rule1.after(clone);
|
|
99
|
-
}
|
|
100
|
-
rule1.remove();
|
|
101
|
-
}
|
|
102
|
-
return rules;
|
|
103
|
-
}
|
|
104
53
|
function parseVariantFormatString(input) {
|
|
105
54
|
if (input.includes('{')) {
|
|
106
55
|
if (!isBalanced(input)) throw new Error(`Your { and } are unbalanced.`);
|
|
@@ -125,8 +74,7 @@ function isBalanced(input) {
|
|
|
125
74
|
}
|
|
126
75
|
return count === 0;
|
|
127
76
|
}
|
|
128
|
-
function insertInto(list, value, { before =[] } = {
|
|
129
|
-
}) {
|
|
77
|
+
function insertInto(list, value, { before =[] } = {}) {
|
|
130
78
|
before = [].concat(before);
|
|
131
79
|
if (before.length <= 0) {
|
|
132
80
|
list.push(value);
|
|
@@ -232,8 +180,7 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
232
180
|
return context.tailwindConfig.prefix + identifier;
|
|
233
181
|
}
|
|
234
182
|
return {
|
|
235
|
-
addVariant (variantName, variantFunctions, options = {
|
|
236
|
-
}) {
|
|
183
|
+
addVariant (variantName, variantFunctions, options = {}) {
|
|
237
184
|
variantFunctions = [].concat(variantFunctions).map((variantFunction)=>{
|
|
238
185
|
if (typeof variantFunction !== 'string') {
|
|
239
186
|
// Safelist public API functions
|
|
@@ -294,37 +241,34 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
294
241
|
return [];
|
|
295
242
|
},
|
|
296
243
|
addUserCss (userCss) {
|
|
297
|
-
for (let [identifier,
|
|
244
|
+
for (let [identifier, rule] of withIdentifiers(userCss)){
|
|
298
245
|
let offset = offsets.user++;
|
|
299
246
|
if (!context.candidateRuleMap.has(identifier)) {
|
|
300
247
|
context.candidateRuleMap.set(identifier, []);
|
|
301
248
|
}
|
|
302
|
-
context.candidateRuleMap.get(identifier).push(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
));
|
|
249
|
+
context.candidateRuleMap.get(identifier).push([
|
|
250
|
+
{
|
|
251
|
+
sort: offset,
|
|
252
|
+
layer: 'user'
|
|
253
|
+
},
|
|
254
|
+
rule
|
|
255
|
+
]);
|
|
310
256
|
}
|
|
311
257
|
},
|
|
312
258
|
addBase (base) {
|
|
313
|
-
for (let [identifier,
|
|
314
|
-
let prefixedIdentifier = prefixIdentifier(identifier, {
|
|
315
|
-
});
|
|
259
|
+
for (let [identifier, rule] of withIdentifiers(base)){
|
|
260
|
+
let prefixedIdentifier = prefixIdentifier(identifier, {});
|
|
316
261
|
let offset = offsets.base++;
|
|
317
262
|
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
|
|
318
263
|
context.candidateRuleMap.set(prefixedIdentifier, []);
|
|
319
264
|
}
|
|
320
|
-
context.candidateRuleMap.get(prefixedIdentifier).push(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
));
|
|
265
|
+
context.candidateRuleMap.get(prefixedIdentifier).push([
|
|
266
|
+
{
|
|
267
|
+
sort: offset,
|
|
268
|
+
layer: 'base'
|
|
269
|
+
},
|
|
270
|
+
rule
|
|
271
|
+
]);
|
|
328
272
|
}
|
|
329
273
|
},
|
|
330
274
|
/**
|
|
@@ -334,20 +278,18 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
334
278
|
const groups = {
|
|
335
279
|
[`@defaults ${group}`]: declarations
|
|
336
280
|
};
|
|
337
|
-
for (let [identifier,
|
|
338
|
-
let prefixedIdentifier = prefixIdentifier(identifier, {
|
|
339
|
-
});
|
|
281
|
+
for (let [identifier, rule] of withIdentifiers(groups)){
|
|
282
|
+
let prefixedIdentifier = prefixIdentifier(identifier, {});
|
|
340
283
|
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
|
|
341
284
|
context.candidateRuleMap.set(prefixedIdentifier, []);
|
|
342
285
|
}
|
|
343
|
-
context.candidateRuleMap.get(prefixedIdentifier).push(
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
));
|
|
286
|
+
context.candidateRuleMap.get(prefixedIdentifier).push([
|
|
287
|
+
{
|
|
288
|
+
sort: offsets.base++,
|
|
289
|
+
layer: 'defaults'
|
|
290
|
+
},
|
|
291
|
+
rule
|
|
292
|
+
]);
|
|
351
293
|
}
|
|
352
294
|
},
|
|
353
295
|
addComponents (components, options) {
|
|
@@ -355,24 +297,21 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
355
297
|
respectPrefix: true,
|
|
356
298
|
respectImportant: false
|
|
357
299
|
};
|
|
358
|
-
options = Object.assign({
|
|
359
|
-
|
|
360
|
-
} : options);
|
|
361
|
-
for (let [identifier, rule5] of withIdentifiers(components)){
|
|
300
|
+
options = Object.assign({}, defaultOptions, Array.isArray(options) ? {} : options);
|
|
301
|
+
for (let [identifier, rule] of withIdentifiers(components)){
|
|
362
302
|
let prefixedIdentifier = prefixIdentifier(identifier, options);
|
|
363
303
|
classList.add(prefixedIdentifier);
|
|
364
304
|
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
|
|
365
305
|
context.candidateRuleMap.set(prefixedIdentifier, []);
|
|
366
306
|
}
|
|
367
|
-
context.candidateRuleMap.get(prefixedIdentifier).push(
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
));
|
|
307
|
+
context.candidateRuleMap.get(prefixedIdentifier).push([
|
|
308
|
+
{
|
|
309
|
+
sort: offsets.components++,
|
|
310
|
+
layer: 'components',
|
|
311
|
+
options
|
|
312
|
+
},
|
|
313
|
+
rule
|
|
314
|
+
]);
|
|
376
315
|
}
|
|
377
316
|
},
|
|
378
317
|
addUtilities (utilities, options) {
|
|
@@ -380,24 +319,21 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
380
319
|
respectPrefix: true,
|
|
381
320
|
respectImportant: true
|
|
382
321
|
};
|
|
383
|
-
options = Object.assign({
|
|
384
|
-
|
|
385
|
-
} : options);
|
|
386
|
-
for (let [identifier, rule6] of withIdentifiers(utilities)){
|
|
322
|
+
options = Object.assign({}, defaultOptions, Array.isArray(options) ? {} : options);
|
|
323
|
+
for (let [identifier, rule] of withIdentifiers(utilities)){
|
|
387
324
|
let prefixedIdentifier = prefixIdentifier(identifier, options);
|
|
388
325
|
classList.add(prefixedIdentifier);
|
|
389
326
|
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
|
|
390
327
|
context.candidateRuleMap.set(prefixedIdentifier, []);
|
|
391
328
|
}
|
|
392
|
-
context.candidateRuleMap.get(prefixedIdentifier).push(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
));
|
|
329
|
+
context.candidateRuleMap.get(prefixedIdentifier).push([
|
|
330
|
+
{
|
|
331
|
+
sort: offsets.utilities++,
|
|
332
|
+
layer: 'utilities',
|
|
333
|
+
options
|
|
334
|
+
},
|
|
335
|
+
rule
|
|
336
|
+
]);
|
|
401
337
|
}
|
|
402
338
|
},
|
|
403
339
|
matchUtilities: function(utilities, options) {
|
|
@@ -740,8 +676,7 @@ function registerPlugins(plugins, context) {
|
|
|
740
676
|
let utils = Array.isArray(util) ? (()=>{
|
|
741
677
|
let [utilName, options] = util;
|
|
742
678
|
var ref;
|
|
743
|
-
let classes = Object.keys((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {
|
|
744
|
-
}).map((value)=>(0, _nameClass).formatClass(utilName, value)
|
|
679
|
+
let classes = Object.keys((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {}).map((value)=>(0, _nameClass).formatClass(utilName, value)
|
|
745
680
|
);
|
|
746
681
|
if (options === null || options === void 0 ? void 0 : options.supportsNegativeValues) {
|
|
747
682
|
classes = [
|
|
@@ -795,8 +730,7 @@ function registerPlugins(plugins, context) {
|
|
|
795
730
|
let [utilName, options] = util;
|
|
796
731
|
let negativeClasses = [];
|
|
797
732
|
var ref;
|
|
798
|
-
for (let [key, value] of Object.entries((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {
|
|
799
|
-
})){
|
|
733
|
+
for (let [key, value] of Object.entries((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {})){
|
|
800
734
|
output.push((0, _nameClass).formatClass(utilName, key));
|
|
801
735
|
if ((options === null || options === void 0 ? void 0 : options.supportsNegativeValues) && (0, _negateValue).default(value)) {
|
|
802
736
|
negativeClasses.push((0, _nameClass).formatClass(utilName, `-${key}`));
|
|
@@ -11,6 +11,7 @@ var _substituteScreenAtRules = _interopRequireDefault(require("./lib/substituteS
|
|
|
11
11
|
var _resolveDefaultsAtRules = _interopRequireDefault(require("./lib/resolveDefaultsAtRules"));
|
|
12
12
|
var _collapseAdjacentRules = _interopRequireDefault(require("./lib/collapseAdjacentRules"));
|
|
13
13
|
var _collapseDuplicateDeclarations = _interopRequireDefault(require("./lib/collapseDuplicateDeclarations"));
|
|
14
|
+
var _partitionApplyAtRules = _interopRequireDefault(require("./lib/partitionApplyAtRules"));
|
|
14
15
|
var _detectNesting = _interopRequireDefault(require("./lib/detectNesting"));
|
|
15
16
|
var _setupContextUtils = require("./lib/setupContextUtils");
|
|
16
17
|
var _featureFlags = require("./featureFlags");
|
|
@@ -23,6 +24,7 @@ function processTailwindFeatures(setupContext) {
|
|
|
23
24
|
return function(root, result) {
|
|
24
25
|
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives).default(root);
|
|
25
26
|
(0, _detectNesting).default()(root, result);
|
|
27
|
+
(0, _partitionApplyAtRules).default()(root, result);
|
|
26
28
|
let context = setupContext({
|
|
27
29
|
tailwindDirectives,
|
|
28
30
|
applyDirectives,
|
package/lib/util/createPlugin.js
CHANGED
|
@@ -9,8 +9,7 @@ function createPlugin(plugin, config) {
|
|
|
9
9
|
config
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({
|
|
13
|
-
})
|
|
12
|
+
createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({})
|
|
14
13
|
) {
|
|
15
14
|
const optionsFunction = function(options) {
|
|
16
15
|
return {
|
|
@@ -16,8 +16,7 @@ function createUtilityPlugin(themeKey, utilityVariations = [
|
|
|
16
16
|
themeKey
|
|
17
17
|
]
|
|
18
18
|
]
|
|
19
|
-
], { filterDefault =false , ...options } = {
|
|
20
|
-
}) {
|
|
19
|
+
], { filterDefault =false , ...options } = {}) {
|
|
21
20
|
let transformValue = (0, _transformThemeValue).default(themeKey);
|
|
22
21
|
return function({ matchUtilities , theme }) {
|
|
23
22
|
for (let utilityVariation of utilityVariations){
|
|
@@ -37,15 +36,12 @@ function createUtilityPlugin(themeKey, utilityVariations = [
|
|
|
37
36
|
return Object.assign(obj, {
|
|
38
37
|
[name]: transformValue(value)
|
|
39
38
|
});
|
|
40
|
-
}, {
|
|
41
|
-
});
|
|
39
|
+
}, {});
|
|
42
40
|
}
|
|
43
41
|
});
|
|
44
|
-
}, {
|
|
45
|
-
}), {
|
|
42
|
+
}, {}), {
|
|
46
43
|
...options,
|
|
47
|
-
values: filterDefault ? Object.fromEntries(Object.entries((ref = theme(themeKey)) !== null && ref !== void 0 ? ref : {
|
|
48
|
-
}).filter(([modifier])=>modifier !== 'DEFAULT'
|
|
44
|
+
values: filterDefault ? Object.fromEntries(Object.entries((ref = theme(themeKey)) !== null && ref !== void 0 ? ref : {}).filter(([modifier])=>modifier !== 'DEFAULT'
|
|
49
45
|
)) : theme(themeKey)
|
|
50
46
|
});
|
|
51
47
|
}
|
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
const flattenColorPalette = (colors)=>Object.assign({
|
|
7
|
-
}, ...Object.entries(colors !== null && colors !== void 0 ? colors : {
|
|
8
|
-
}).flatMap(([color, values])=>typeof values == 'object' ? Object.entries(flattenColorPalette(values)).map(([number, hex])=>({
|
|
6
|
+
const flattenColorPalette = (colors)=>Object.assign({}, ...Object.entries(colors !== null && colors !== void 0 ? colors : {}).flatMap(([color, values])=>typeof values == 'object' ? Object.entries(flattenColorPalette(values)).map(([number, hex])=>({
|
|
9
7
|
[color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex
|
|
10
8
|
})
|
|
11
9
|
) : [
|
|
@@ -8,13 +8,11 @@ function _interopRequireWildcard(obj) {
|
|
|
8
8
|
if (obj && obj.__esModule) {
|
|
9
9
|
return obj;
|
|
10
10
|
} else {
|
|
11
|
-
var newObj = {
|
|
12
|
-
};
|
|
11
|
+
var newObj = {};
|
|
13
12
|
if (obj != null) {
|
|
14
13
|
for(var key in obj){
|
|
15
14
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
16
|
-
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
|
|
17
|
-
};
|
|
15
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
18
16
|
if (desc.get || desc.set) {
|
|
19
17
|
Object.defineProperty(newObj, key, desc);
|
|
20
18
|
} else {
|
|
@@ -169,11 +167,9 @@ function normalizeConfig(config) {
|
|
|
169
167
|
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;
|
|
170
168
|
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;
|
|
171
169
|
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;
|
|
172
|
-
return {
|
|
173
|
-
};
|
|
170
|
+
return {};
|
|
174
171
|
})();
|
|
175
|
-
let extractors = {
|
|
176
|
-
};
|
|
172
|
+
let extractors = {};
|
|
177
173
|
let defaultExtractor = (()=>{
|
|
178
174
|
var ref, ref10, ref11, ref12;
|
|
179
175
|
if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref10 = ref.options) === null || ref10 === void 0 ? void 0 : ref10.defaultExtractor) {
|
|
@@ -208,11 +204,9 @@ function normalizeConfig(config) {
|
|
|
208
204
|
if ((ref13 = config.content) === null || ref13 === void 0 ? void 0 : ref13.transform) return config.content.transform;
|
|
209
205
|
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;
|
|
210
206
|
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;
|
|
211
|
-
return {
|
|
212
|
-
};
|
|
207
|
+
return {};
|
|
213
208
|
})();
|
|
214
|
-
let transformers = {
|
|
215
|
-
};
|
|
209
|
+
let transformers = {};
|
|
216
210
|
if (typeof transform === 'function') {
|
|
217
211
|
transformers.DEFAULT = transform;
|
|
218
212
|
}
|
|
@@ -48,11 +48,9 @@ function normalizeScreens(screens, root = true) {
|
|
|
48
48
|
};
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {
|
|
52
|
-
}), false);
|
|
51
|
+
return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
|
|
53
52
|
}
|
|
54
|
-
function resolveValue({ 'min-width': _minWidth , min =_minWidth , max , raw } = {
|
|
55
|
-
}) {
|
|
53
|
+
function resolveValue({ 'min-width': _minWidth , min =_minWidth , max , raw } = {}) {
|
|
56
54
|
return {
|
|
57
55
|
min,
|
|
58
56
|
max,
|
package/lib/util/pluginUtils.js
CHANGED
|
@@ -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
|
-
}
|
|
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,10 +80,7 @@ function splitAlpha(modifier) {
|
|
|
83
80
|
modifier.slice(slashIdx + 1)
|
|
84
81
|
];
|
|
85
82
|
}
|
|
86
|
-
function asColor(modifier, options = {
|
|
87
|
-
}, { tailwindConfig ={
|
|
88
|
-
} } = {
|
|
89
|
-
}) {
|
|
83
|
+
function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
90
84
|
var ref;
|
|
91
85
|
if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
|
|
92
86
|
var ref1;
|
|
@@ -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
|
}
|
|
@@ -53,8 +53,7 @@ const configUtils = {
|
|
|
53
53
|
negativeScale[`-${key}`] = negativeValue;
|
|
54
54
|
}
|
|
55
55
|
return negativeScale;
|
|
56
|
-
}, {
|
|
57
|
-
});
|
|
56
|
+
}, {});
|
|
58
57
|
},
|
|
59
58
|
breakpoints (screens) {
|
|
60
59
|
return Object.keys(screens).filter((key)=>typeof screens[key] === 'string'
|
|
@@ -62,8 +61,7 @@ const configUtils = {
|
|
|
62
61
|
...breakpoints,
|
|
63
62
|
[`screen-${key}`]: screens[key]
|
|
64
63
|
})
|
|
65
|
-
, {
|
|
66
|
-
});
|
|
64
|
+
, {});
|
|
67
65
|
}
|
|
68
66
|
};
|
|
69
67
|
function value(valueToResolve, ...args) {
|
|
@@ -88,14 +86,12 @@ function collectExtends(items) {
|
|
|
88
86
|
mergedValue
|
|
89
87
|
];
|
|
90
88
|
});
|
|
91
|
-
}, {
|
|
92
|
-
});
|
|
89
|
+
}, {});
|
|
93
90
|
}
|
|
94
91
|
function mergeThemes(themes) {
|
|
95
92
|
return {
|
|
96
93
|
...themes.reduce((merged, theme)=>(0, _defaults).defaults(merged, theme)
|
|
97
|
-
, {
|
|
98
|
-
}),
|
|
94
|
+
, {}),
|
|
99
95
|
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
100
96
|
// into arrays instead of objects so they aren't overridden.
|
|
101
97
|
extend: collectExtends(themes)
|
|
@@ -124,11 +120,9 @@ function mergeExtensions({ extend , ...theme }) {
|
|
|
124
120
|
return mergeWith(theme, extend, (themeValue, extensions)=>{
|
|
125
121
|
// The `extend` property is an array, so we need to check if it contains any functions
|
|
126
122
|
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
127
|
-
return mergeWith({
|
|
128
|
-
}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
123
|
+
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
129
124
|
}
|
|
130
|
-
return (resolveThemePath, utils)=>mergeWith({
|
|
131
|
-
}, ...[
|
|
125
|
+
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
|
132
126
|
themeValue,
|
|
133
127
|
...extensions
|
|
134
128
|
].map((e)=>value(e, resolveThemePath, utils)
|
|
@@ -162,8 +156,7 @@ function resolveFunctionKeys(object) {
|
|
|
162
156
|
...resolved,
|
|
163
157
|
[key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
|
|
164
158
|
};
|
|
165
|
-
}, {
|
|
166
|
-
});
|
|
159
|
+
}, {});
|
|
167
160
|
}
|
|
168
161
|
function extractPluginConfigs(configs) {
|
|
169
162
|
let allConfigs = [];
|
|
@@ -185,8 +178,7 @@ function extractPluginConfigs(configs) {
|
|
|
185
178
|
allConfigs = [
|
|
186
179
|
...allConfigs,
|
|
187
180
|
...extractPluginConfigs([
|
|
188
|
-
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {
|
|
189
|
-
}
|
|
181
|
+
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
|
|
190
182
|
])
|
|
191
183
|
];
|
|
192
184
|
});
|
|
@@ -230,8 +222,7 @@ function resolveConfig(configs) {
|
|
|
230
222
|
var ref, ref2;
|
|
231
223
|
return (0, _normalizeConfig).normalizeConfig((0, _defaults).defaults({
|
|
232
224
|
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
233
|
-
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
|
|
234
|
-
};
|
|
225
|
+
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
|
|
235
226
|
})))),
|
|
236
227
|
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
|
|
237
228
|
)),
|
package/lib/util/toColorValue.js
CHANGED
|
@@ -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
|
}
|
|
@@ -15,8 +15,7 @@ function transformThemeValue(themeSection) {
|
|
|
15
15
|
'outline'
|
|
16
16
|
].includes(themeSection)) {
|
|
17
17
|
return (value)=>{
|
|
18
|
-
if (typeof value === 'function') value = value({
|
|
19
|
-
});
|
|
18
|
+
if (typeof value === 'function') value = value({});
|
|
20
19
|
if (Array.isArray(value)) value = value[0];
|
|
21
20
|
return value;
|
|
22
21
|
};
|
|
@@ -35,8 +34,7 @@ function transformThemeValue(themeSection) {
|
|
|
35
34
|
'animation',
|
|
36
35
|
].includes(themeSection)) {
|
|
37
36
|
return (value)=>{
|
|
38
|
-
if (typeof value === 'function') value = value({
|
|
39
|
-
});
|
|
37
|
+
if (typeof value === 'function') value = value({});
|
|
40
38
|
if (Array.isArray(value)) value = value.join(', ');
|
|
41
39
|
return value;
|
|
42
40
|
};
|
|
@@ -49,15 +47,13 @@ function transformThemeValue(themeSection) {
|
|
|
49
47
|
'objectPosition'
|
|
50
48
|
].includes(themeSection)) {
|
|
51
49
|
return (value)=>{
|
|
52
|
-
if (typeof value === 'function') value = value({
|
|
53
|
-
});
|
|
50
|
+
if (typeof value === 'function') value = value({});
|
|
54
51
|
if (typeof value === 'string') value = _postcss.default.list.comma(value).join(' ');
|
|
55
52
|
return value;
|
|
56
53
|
};
|
|
57
54
|
}
|
|
58
55
|
return (value)=>{
|
|
59
|
-
if (typeof value === 'function') value = value({
|
|
60
|
-
});
|
|
56
|
+
if (typeof value === 'function') value = value({});
|
|
61
57
|
return value;
|
|
62
58
|
};
|
|
63
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.13",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -44,20 +44,18 @@
|
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@swc/cli": "^0.1.55",
|
|
47
|
-
"@swc/core": "^1.2.
|
|
47
|
+
"@swc/core": "^1.2.127",
|
|
48
48
|
"@swc/jest": "^0.2.15",
|
|
49
49
|
"@swc/register": "^0.1.7",
|
|
50
50
|
"autoprefixer": "^10.4.1",
|
|
51
|
-
"cross-env": "^7.0.3",
|
|
52
51
|
"cssnano": "^5.0.14",
|
|
53
|
-
"esbuild": "^0.14.
|
|
54
|
-
"eslint": "^8.
|
|
52
|
+
"esbuild": "^0.14.10",
|
|
53
|
+
"eslint": "^8.6.0",
|
|
55
54
|
"eslint-config-prettier": "^8.3.0",
|
|
56
55
|
"eslint-plugin-prettier": "^4.0.0",
|
|
57
56
|
"jest": "^27.4.5",
|
|
58
57
|
"jest-diff": "^27.4.2",
|
|
59
58
|
"postcss": "^8.4.5",
|
|
60
|
-
"postcss-cli": "^8.3.1",
|
|
61
59
|
"prettier": "^2.5.1",
|
|
62
60
|
"rimraf": "^3.0.0"
|
|
63
61
|
},
|
|
@@ -85,7 +83,7 @@
|
|
|
85
83
|
"postcss-selector-parser": "^6.0.8",
|
|
86
84
|
"postcss-value-parser": "^4.2.0",
|
|
87
85
|
"quick-lru": "^5.1.1",
|
|
88
|
-
"resolve": "^1.
|
|
86
|
+
"resolve": "^1.21.0"
|
|
89
87
|
},
|
|
90
88
|
"browserslist": [
|
|
91
89
|
"> 1%",
|