tailwindcss 3.0.11 → 3.0.15
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 +44 -4
- package/lib/cli.js +8 -16
- package/lib/corePlugins.js +183 -280
- package/lib/css/preflight.css +1 -1
- package/lib/featureFlags.js +2 -5
- package/lib/lib/expandApplyAtRules.js +0 -40
- package/lib/lib/expandTailwindAtRules.js +31 -38
- package/lib/lib/generateRules.js +8 -2
- package/lib/lib/partitionApplyAtRules.js +53 -0
- package/lib/lib/resolveDefaultsAtRules.js +4 -4
- package/lib/lib/setupContextUtils.js +41 -51
- package/lib/processTailwindFeatures.js +3 -1
- 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 +11 -12
- package/lib/util/normalizeScreens.js +2 -4
- package/lib/util/pluginUtils.js +6 -13
- 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/nesting/plugin.js +4 -1
- package/package.json +9 -11
- package/peers/index.js +652 -651
- package/src/corePlugins.js +121 -155
- package/src/css/preflight.css +1 -1
- package/src/featureFlags.js +1 -5
- package/src/lib/expandApplyAtRules.js +0 -42
- package/src/lib/expandTailwindAtRules.js +33 -29
- package/src/lib/generateRules.js +6 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/resolveDefaultsAtRules.js +5 -5
- package/src/lib/setupContextUtils.js +29 -16
- package/src/processTailwindFeatures.js +4 -1
- package/src/util/normalizeConfig.js +6 -0
- package/src/util/pluginUtils.js +1 -1
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
|
}
|
|
@@ -177,7 +170,7 @@ function coerceValue(types, modifier, options, tailwindConfig) {
|
|
|
177
170
|
let result = typeMap[type](modifier, options, {
|
|
178
171
|
tailwindConfig
|
|
179
172
|
});
|
|
180
|
-
if (result) return [
|
|
173
|
+
if (result !== undefined) return [
|
|
181
174
|
result,
|
|
182
175
|
type
|
|
183
176
|
];
|
|
@@ -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/nesting/plugin.js
CHANGED
|
@@ -14,7 +14,10 @@ module.exports = function nesting(opts = postcssNested) {
|
|
|
14
14
|
})
|
|
15
15
|
|
|
16
16
|
let plugin = (() => {
|
|
17
|
-
if (
|
|
17
|
+
if (
|
|
18
|
+
typeof opts === 'function' ||
|
|
19
|
+
(typeof opts === 'object' && opts.hasOwnProperty('postcssPlugin'))
|
|
20
|
+
) {
|
|
18
21
|
return opts
|
|
19
22
|
}
|
|
20
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.15",
|
|
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
|
-
"autoprefixer": "^10.4.
|
|
51
|
-
"cross-env": "^7.0.3",
|
|
50
|
+
"autoprefixer": "^10.4.1",
|
|
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
|
-
"jest": "^27.4.
|
|
58
|
-
"jest-diff": "^27.4.
|
|
56
|
+
"jest": "^27.4.7",
|
|
57
|
+
"jest-diff": "^27.4.6",
|
|
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
|
},
|
|
@@ -82,10 +80,10 @@
|
|
|
82
80
|
"postcss-js": "^4.0.0",
|
|
83
81
|
"postcss-load-config": "^3.1.0",
|
|
84
82
|
"postcss-nested": "5.0.6",
|
|
85
|
-
"postcss-selector-parser": "^6.0.
|
|
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%",
|