tailwindcss 0.0.0-insiders.ee3f3fd → 0.0.0-insiders.ef325ea
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 +41 -3
- package/lib/cli.js +61 -61
- package/lib/constants.js +1 -1
- package/lib/corePluginList.js +5 -1
- package/lib/corePlugins.js +118 -51
- package/lib/featureFlags.js +3 -3
- package/lib/lib/collapseDuplicateDeclarations.js +2 -2
- package/lib/lib/detectNesting.js +17 -2
- package/lib/lib/evaluateTailwindFunctions.js +9 -5
- package/lib/lib/expandApplyAtRules.js +7 -7
- package/lib/lib/generateRules.js +10 -10
- package/lib/lib/resolveDefaultsAtRules.js +2 -2
- package/lib/lib/setupContextUtils.js +9 -8
- package/lib/lib/sharedState.js +2 -2
- package/lib/lib/substituteScreenAtRules.js +7 -4
- package/lib/util/buildMediaQuery.js +13 -24
- package/lib/util/createUtilityPlugin.js +2 -2
- package/lib/util/dataTypes.js +11 -0
- package/lib/util/formatVariantSelector.js +83 -8
- package/lib/util/normalizeConfig.js +7 -7
- package/lib/util/normalizeScreens.js +58 -0
- package/lib/util/parseBoxShadowValue.js +77 -0
- package/lib/util/pluginUtils.js +12 -11
- package/lib/util/resolveConfig.js +8 -8
- package/lib/util/transformThemeValue.js +23 -13
- package/package.json +8 -8
- package/peers/index.js +3757 -4843
- package/src/cli.js +1 -1
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +75 -41
- package/src/lib/detectNesting.js +22 -3
- package/src/lib/evaluateTailwindFunctions.js +5 -2
- package/src/lib/setupContextUtils.js +2 -1
- package/src/lib/sharedState.js +1 -1
- package/src/lib/substituteScreenAtRules.js +6 -3
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/dataTypes.js +13 -0
- package/src/util/formatVariantSelector.js +81 -0
- package/src/util/normalizeScreens.js +42 -0
- package/src/util/parseBoxShadowValue.js +71 -0
- package/src/util/pluginUtils.js +2 -0
- package/src/util/transformThemeValue.js +22 -7
- package/stubs/defaultConfig.stub.js +23 -14
package/lib/corePlugins.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.
|
|
5
|
+
exports.corePlugins = exports.variantPlugins = void 0;
|
|
6
6
|
var _fs = _interopRequireDefault(require("fs"));
|
|
7
7
|
var path = _interopRequireWildcard(require("path"));
|
|
8
8
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
@@ -16,6 +16,8 @@ var _isPlainObject = _interopRequireDefault(require("./util/isPlainObject"));
|
|
|
16
16
|
var _transformThemeValue = _interopRequireDefault(require("./util/transformThemeValue"));
|
|
17
17
|
var _packageJson = require("../package.json");
|
|
18
18
|
var _log = _interopRequireDefault(require("./util/log"));
|
|
19
|
+
var _normalizeScreens = require("./util/normalizeScreens");
|
|
20
|
+
var _parseBoxShadowValue = require("./util/parseBoxShadowValue");
|
|
19
21
|
function _interopRequireDefault(obj) {
|
|
20
22
|
return obj && obj.__esModule ? obj : {
|
|
21
23
|
default: obj
|
|
@@ -57,6 +59,7 @@ let variantPlugins = {
|
|
|
57
59
|
'&::selection'
|
|
58
60
|
]);
|
|
59
61
|
addVariant('file', '&::file-selector-button');
|
|
62
|
+
addVariant('placeholder', '&::placeholder');
|
|
60
63
|
addVariant('before', ({ container })=>{
|
|
61
64
|
container.walkRules((rule)=>{
|
|
62
65
|
let foundContent = false;
|
|
@@ -192,16 +195,18 @@ let variantPlugins = {
|
|
|
192
195
|
addVariant('dark', '@media (prefers-color-scheme: dark)');
|
|
193
196
|
}
|
|
194
197
|
},
|
|
198
|
+
printVariant: ({ addVariant })=>{
|
|
199
|
+
addVariant('print', '@media print');
|
|
200
|
+
},
|
|
195
201
|
screenVariants: ({ theme , addVariant })=>{
|
|
196
|
-
for(let screen
|
|
197
|
-
let
|
|
198
|
-
|
|
199
|
-
addVariant(screen, `@media ${query}`);
|
|
202
|
+
for (let screen of (0, _normalizeScreens).normalizeScreens(theme('screens'))){
|
|
203
|
+
let query = (0, _buildMediaQuery).default(screen);
|
|
204
|
+
addVariant(screen.name, `@media ${query}`);
|
|
200
205
|
}
|
|
201
206
|
}
|
|
202
207
|
};
|
|
203
208
|
exports.variantPlugins = variantPlugins;
|
|
204
|
-
let
|
|
209
|
+
let corePlugins1 = {
|
|
205
210
|
preflight: ({ addBase })=>{
|
|
206
211
|
let preflightStyles = _postcss.default.parse(_fs.default.readFileSync(path.join(__dirname, './css/preflight.css'), 'utf8'));
|
|
207
212
|
addBase([
|
|
@@ -212,27 +217,11 @@ let corePlugins = {
|
|
|
212
217
|
]);
|
|
213
218
|
},
|
|
214
219
|
container: (()=>{
|
|
215
|
-
function extractMinWidths(breakpoints) {
|
|
216
|
-
return
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
min: breakpoints
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
if (!Array.isArray(breakpoints)) {
|
|
224
|
-
breakpoints = [
|
|
225
|
-
breakpoints
|
|
226
|
-
];
|
|
227
|
-
}
|
|
228
|
-
return breakpoints.filter((breakpoint)=>{
|
|
229
|
-
var ref;
|
|
230
|
-
return (breakpoint === null || breakpoint === void 0 ? void 0 : (ref = breakpoint.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(breakpoint, 'min')) || (breakpoint === null || breakpoint === void 0 ? void 0 : breakpoint.hasOwnProperty('min-width'));
|
|
231
|
-
}).map((breakpoint)=>{
|
|
232
|
-
var ref;
|
|
233
|
-
return (ref = breakpoint['min-width']) !== null && ref !== void 0 ? ref : breakpoint.min;
|
|
234
|
-
});
|
|
235
|
-
});
|
|
220
|
+
function extractMinWidths(breakpoints = []) {
|
|
221
|
+
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min
|
|
222
|
+
)
|
|
223
|
+
).filter((v)=>v !== undefined
|
|
224
|
+
);
|
|
236
225
|
}
|
|
237
226
|
function mapMinWidthsToPadding(minWidths, screens, paddings) {
|
|
238
227
|
if (typeof paddings === 'undefined') {
|
|
@@ -256,25 +245,25 @@ let corePlugins = {
|
|
|
256
245
|
});
|
|
257
246
|
}
|
|
258
247
|
for (let minWidth of minWidths){
|
|
259
|
-
for (let
|
|
260
|
-
let
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
248
|
+
for (let screen of screens){
|
|
249
|
+
for (let { min } of screen.values){
|
|
250
|
+
if (min === minWidth) {
|
|
251
|
+
mapping.push({
|
|
252
|
+
minWidth,
|
|
253
|
+
padding: paddings[screen.name]
|
|
254
|
+
});
|
|
255
|
+
}
|
|
267
256
|
}
|
|
268
257
|
}
|
|
269
258
|
}
|
|
270
259
|
return mapping;
|
|
271
260
|
}
|
|
272
261
|
return function({ addComponents , theme }) {
|
|
273
|
-
let screens = theme('container.screens', theme('screens'));
|
|
262
|
+
let screens = (0, _normalizeScreens).normalizeScreens(theme('container.screens', theme('screens')));
|
|
274
263
|
let minWidths = extractMinWidths(screens);
|
|
275
264
|
let paddings = mapMinWidthsToPadding(minWidths, screens, theme('container.padding'));
|
|
276
265
|
let generatePaddingFor = (minWidth)=>{
|
|
277
|
-
let paddingConfig = paddings.find((padding)
|
|
266
|
+
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth
|
|
278
267
|
);
|
|
279
268
|
if (!paddingConfig) {
|
|
280
269
|
return {
|
|
@@ -986,8 +975,8 @@ let corePlugins = {
|
|
|
986
975
|
];
|
|
987
976
|
}));
|
|
988
977
|
matchUtilities({
|
|
989
|
-
animate: (
|
|
990
|
-
let animations = (0, _parseAnimationValue).default(
|
|
978
|
+
animate: (value1)=>{
|
|
979
|
+
let animations = (0, _parseAnimationValue).default(value1);
|
|
991
980
|
return [
|
|
992
981
|
...animations.flatMap((animation)=>keyframes[animation.name]
|
|
993
982
|
),
|
|
@@ -2992,38 +2981,115 @@ let corePlugins = {
|
|
|
2992
2981
|
'@defaults box-shadow': {
|
|
2993
2982
|
'--tw-ring-offset-shadow': '0 0 #0000',
|
|
2994
2983
|
'--tw-ring-shadow': '0 0 #0000',
|
|
2995
|
-
'--tw-shadow': '0 0 #0000'
|
|
2984
|
+
'--tw-shadow': '0 0 #0000',
|
|
2985
|
+
'--tw-shadow-colored': '0 0 #0000'
|
|
2996
2986
|
}
|
|
2997
2987
|
});
|
|
2998
2988
|
matchUtilities({
|
|
2999
2989
|
shadow: (value)=>{
|
|
3000
2990
|
value = transformValue(value);
|
|
2991
|
+
let ast = (0, _parseBoxShadowValue).parseBoxShadowValue(value);
|
|
2992
|
+
for (let shadow of ast){
|
|
2993
|
+
// Don't override color if the whole shadow is a variable
|
|
2994
|
+
if (!shadow.valid) {
|
|
2995
|
+
continue;
|
|
2996
|
+
}
|
|
2997
|
+
shadow.color = 'var(--tw-shadow-color)';
|
|
2998
|
+
}
|
|
3001
2999
|
return {
|
|
3002
3000
|
'@defaults box-shadow': {
|
|
3003
3001
|
},
|
|
3004
3002
|
'--tw-shadow': value === 'none' ? '0 0 #0000' : value,
|
|
3003
|
+
'--tw-shadow-colored': value === 'none' ? '0 0 #0000' : (0, _parseBoxShadowValue).formatBoxShadowValue(ast),
|
|
3005
3004
|
'box-shadow': defaultBoxShadow
|
|
3006
3005
|
};
|
|
3007
3006
|
}
|
|
3008
3007
|
}, {
|
|
3009
|
-
values: theme('boxShadow')
|
|
3008
|
+
values: theme('boxShadow'),
|
|
3009
|
+
type: [
|
|
3010
|
+
'shadow'
|
|
3011
|
+
]
|
|
3010
3012
|
});
|
|
3011
3013
|
};
|
|
3012
3014
|
})(),
|
|
3013
|
-
|
|
3015
|
+
boxShadowColor: ({ matchUtilities , theme })=>{
|
|
3016
|
+
matchUtilities({
|
|
3017
|
+
shadow: (value)=>{
|
|
3018
|
+
return {
|
|
3019
|
+
'--tw-shadow-color': (0, _toColorValue).default(value),
|
|
3020
|
+
'--tw-shadow': 'var(--tw-shadow-colored)'
|
|
3021
|
+
};
|
|
3022
|
+
}
|
|
3023
|
+
}, {
|
|
3024
|
+
values: (0, _flattenColorPalette).default(theme('boxShadowColor')),
|
|
3025
|
+
type: [
|
|
3026
|
+
'color'
|
|
3027
|
+
]
|
|
3028
|
+
});
|
|
3029
|
+
},
|
|
3030
|
+
outlineStyle: ({ addUtilities })=>{
|
|
3031
|
+
addUtilities({
|
|
3032
|
+
'.outline-none': {
|
|
3033
|
+
outline: '2px solid transparent',
|
|
3034
|
+
'outline-offset': '2px'
|
|
3035
|
+
},
|
|
3036
|
+
'.outline': {
|
|
3037
|
+
'outline-style': 'solid'
|
|
3038
|
+
},
|
|
3039
|
+
'.outline-dashed': {
|
|
3040
|
+
'outline-style': 'dashed'
|
|
3041
|
+
},
|
|
3042
|
+
'.outline-dotted': {
|
|
3043
|
+
'outline-style': 'dotted'
|
|
3044
|
+
},
|
|
3045
|
+
'.outline-double': {
|
|
3046
|
+
'outline-style': 'double'
|
|
3047
|
+
},
|
|
3048
|
+
'.outline-hidden': {
|
|
3049
|
+
'outline-style': 'hidden'
|
|
3050
|
+
}
|
|
3051
|
+
});
|
|
3052
|
+
},
|
|
3053
|
+
outlineWidth: (0, _createUtilityPlugin).default('outlineWidth', [
|
|
3054
|
+
[
|
|
3055
|
+
'outline',
|
|
3056
|
+
[
|
|
3057
|
+
'outline-width'
|
|
3058
|
+
]
|
|
3059
|
+
]
|
|
3060
|
+
], {
|
|
3061
|
+
type: [
|
|
3062
|
+
'length',
|
|
3063
|
+
'number',
|
|
3064
|
+
'percentage'
|
|
3065
|
+
]
|
|
3066
|
+
}),
|
|
3067
|
+
outlineOffset: (0, _createUtilityPlugin).default('outlineOffset', [
|
|
3068
|
+
[
|
|
3069
|
+
'outline-offset',
|
|
3070
|
+
[
|
|
3071
|
+
'outline-offset'
|
|
3072
|
+
]
|
|
3073
|
+
]
|
|
3074
|
+
], {
|
|
3075
|
+
type: [
|
|
3076
|
+
'length',
|
|
3077
|
+
'number',
|
|
3078
|
+
'percentage'
|
|
3079
|
+
]
|
|
3080
|
+
}),
|
|
3081
|
+
outlineColor: ({ matchUtilities , theme })=>{
|
|
3014
3082
|
matchUtilities({
|
|
3015
3083
|
outline: (value)=>{
|
|
3016
|
-
value = Array.isArray(value) ? value : value.split(',');
|
|
3017
|
-
let [outline, outlineOffset = '0'] = Array.isArray(value) ? value : [
|
|
3018
|
-
value
|
|
3019
|
-
];
|
|
3020
3084
|
return {
|
|
3021
|
-
outline,
|
|
3022
|
-
'outline-offset': outlineOffset
|
|
3085
|
+
'outline-color': (0, _toColorValue).default(value)
|
|
3023
3086
|
};
|
|
3024
3087
|
}
|
|
3025
3088
|
}, {
|
|
3026
|
-
values: theme('
|
|
3089
|
+
values: (0, _flattenColorPalette).default(theme('outlineColor')),
|
|
3090
|
+
type: [
|
|
3091
|
+
'color'
|
|
3092
|
+
]
|
|
3027
3093
|
});
|
|
3028
3094
|
},
|
|
3029
3095
|
ringWidth: ({ matchUtilities , addBase , addUtilities , theme })=>{
|
|
@@ -3037,7 +3103,8 @@ let corePlugins = {
|
|
|
3037
3103
|
'--tw-ring-color': ringColorDefault,
|
|
3038
3104
|
'--tw-ring-offset-shadow': '0 0 #0000',
|
|
3039
3105
|
'--tw-ring-shadow': '0 0 #0000',
|
|
3040
|
-
'--tw-shadow': '0 0 #0000'
|
|
3106
|
+
'--tw-shadow': '0 0 #0000',
|
|
3107
|
+
'--tw-shadow-colored': '0 0 #0000'
|
|
3041
3108
|
}
|
|
3042
3109
|
});
|
|
3043
3110
|
matchUtilities({
|
|
@@ -3507,4 +3574,4 @@ let corePlugins = {
|
|
|
3507
3574
|
],
|
|
3508
3575
|
])
|
|
3509
3576
|
};
|
|
3510
|
-
exports.corePlugins =
|
|
3577
|
+
exports.corePlugins = corePlugins1;
|
package/lib/featureFlags.js
CHANGED
|
@@ -28,9 +28,9 @@ function flagEnabled(config, flag) {
|
|
|
28
28
|
return config.future === 'all' || ((ref2 = (ref1 = config === null || config === void 0 ? void 0 : (ref = config.future) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref1 !== void 0 ? ref1 : defaults[flag]) !== null && ref2 !== void 0 ? ref2 : false);
|
|
29
29
|
}
|
|
30
30
|
if (featureFlags.experimental.includes(flag)) {
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
return config.experimental === 'all' || ((
|
|
31
|
+
var ref3;
|
|
32
|
+
var ref4, ref5;
|
|
33
|
+
return config.experimental === 'all' || ((ref5 = (ref4 = config === null || config === void 0 ? void 0 : (ref3 = config.experimental) === null || ref3 === void 0 ? void 0 : ref3[flag]) !== null && ref4 !== void 0 ? ref4 : defaults[flag]) !== null && ref5 !== void 0 ? ref5 : false);
|
|
34
34
|
}
|
|
35
35
|
return false;
|
|
36
36
|
}
|
package/lib/lib/detectNesting.js
CHANGED
|
@@ -6,12 +6,27 @@ exports.default = _default;
|
|
|
6
6
|
function _default(_context) {
|
|
7
7
|
return (root, result)=>{
|
|
8
8
|
let found = false;
|
|
9
|
+
root.walkAtRules('tailwind', (node)=>{
|
|
10
|
+
if (found) return false;
|
|
11
|
+
if (node.parent && node.parent.type !== 'root') {
|
|
12
|
+
found = true;
|
|
13
|
+
node.warn(result, [
|
|
14
|
+
'Nested @tailwind rules were detected, but are not supported.',
|
|
15
|
+
"Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
|
|
16
|
+
'Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy',
|
|
17
|
+
].join('\n'));
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
9
21
|
root.walkRules((rule)=>{
|
|
10
22
|
if (found) return false;
|
|
11
23
|
rule.walkRules((nestedRule)=>{
|
|
12
24
|
found = true;
|
|
13
|
-
nestedRule.warn(result,
|
|
14
|
-
|
|
25
|
+
nestedRule.warn(result, [
|
|
26
|
+
'Nested CSS was detected, but CSS nesting has not been configured correctly.',
|
|
27
|
+
'Please enable a CSS nesting plugin *before* Tailwind in your configuration.',
|
|
28
|
+
'See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting',
|
|
29
|
+
].join('\n'));
|
|
15
30
|
return false;
|
|
16
31
|
});
|
|
17
32
|
});
|
|
@@ -7,6 +7,7 @@ var _dlv = _interopRequireDefault(require("dlv"));
|
|
|
7
7
|
var _didyoumean = _interopRequireDefault(require("didyoumean"));
|
|
8
8
|
var _transformThemeValue = _interopRequireDefault(require("../util/transformThemeValue"));
|
|
9
9
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
10
|
+
var _normalizeScreens = require("../util/normalizeScreens");
|
|
10
11
|
var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
|
|
11
12
|
var _toPath = require("../util/toPath");
|
|
12
13
|
function _interopRequireDefault(obj) {
|
|
@@ -112,11 +113,11 @@ function extractArgs(node, vNodes, functions) {
|
|
|
112
113
|
let args = [
|
|
113
114
|
''
|
|
114
115
|
];
|
|
115
|
-
for (let
|
|
116
|
-
if (
|
|
116
|
+
for (let vNode1 of vNodes){
|
|
117
|
+
if (vNode1.type === 'div' && vNode1.value === ',') {
|
|
117
118
|
args.push('');
|
|
118
119
|
} else {
|
|
119
|
-
args[args.length - 1] += _postcssValueParser.default.stringify(
|
|
120
|
+
args[args.length - 1] += _postcssValueParser.default.stringify(vNode1);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
return args;
|
|
@@ -149,10 +150,13 @@ function _default({ tailwindConfig: config }) {
|
|
|
149
150
|
},
|
|
150
151
|
screen: (node, screen)=>{
|
|
151
152
|
screen = screen.replace(/^['"]+/g, '').replace(/['"]+$/g, '');
|
|
152
|
-
|
|
153
|
+
let screens = (0, _normalizeScreens).normalizeScreens(config.theme.screens);
|
|
154
|
+
let screenDefinition = screens.find(({ name })=>name === screen
|
|
155
|
+
);
|
|
156
|
+
if (!screenDefinition) {
|
|
153
157
|
throw node.error(`The '${screen}' screen does not exist in your theme.`);
|
|
154
158
|
}
|
|
155
|
-
return (0, _buildMediaQuery).default(
|
|
159
|
+
return (0, _buildMediaQuery).default(screenDefinition);
|
|
156
160
|
}
|
|
157
161
|
};
|
|
158
162
|
return (root)=>{
|
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) {
|
|
|
12
12
|
default: obj
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function prefix1(context, selector) {
|
|
16
16
|
let prefix = context.tailwindConfig.prefix;
|
|
17
17
|
return typeof prefix === 'function' ? prefix(selector) : prefix + selector;
|
|
18
18
|
}
|
|
@@ -56,10 +56,10 @@ function partitionApplyParents(root) {
|
|
|
56
56
|
root.walkAtRules('apply', (rule)=>{
|
|
57
57
|
applyParents.add(rule.parent);
|
|
58
58
|
});
|
|
59
|
-
for (let
|
|
59
|
+
for (let rule1 of applyParents){
|
|
60
60
|
let nodeGroups = [];
|
|
61
61
|
let lastGroup = [];
|
|
62
|
-
for (let node of
|
|
62
|
+
for (let node of rule1.nodes){
|
|
63
63
|
if (node.type === 'atrule' && node.name === 'apply') {
|
|
64
64
|
if (lastGroup.length > 0) {
|
|
65
65
|
nodeGroups.push(lastGroup);
|
|
@@ -81,13 +81,13 @@ function partitionApplyParents(root) {
|
|
|
81
81
|
for (let group of [
|
|
82
82
|
...nodeGroups
|
|
83
83
|
].reverse()){
|
|
84
|
-
let newParent =
|
|
84
|
+
let newParent = rule1.clone({
|
|
85
85
|
nodes: []
|
|
86
86
|
});
|
|
87
87
|
newParent.append(group);
|
|
88
|
-
|
|
88
|
+
rule1.after(newParent);
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
rule1.remove();
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
function processApply(root, context) {
|
|
@@ -156,7 +156,7 @@ function processApply(root, context) {
|
|
|
156
156
|
}
|
|
157
157
|
for (let applyCandidate of applyCandidates){
|
|
158
158
|
if (!applyClassCache.has(applyCandidate)) {
|
|
159
|
-
if (applyCandidate ===
|
|
159
|
+
if (applyCandidate === prefix1(context, 'group')) {
|
|
160
160
|
// TODO: Link to specific documentation page with error code.
|
|
161
161
|
throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`);
|
|
162
162
|
}
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -120,10 +120,10 @@ function applyVariant(variant, matches, context) {
|
|
|
120
120
|
if (context.variantMap.has(variant)) {
|
|
121
121
|
let variantFunctionTuples = context.variantMap.get(variant);
|
|
122
122
|
let result = [];
|
|
123
|
-
for (let [meta,
|
|
123
|
+
for (let [meta, rule1] of matches){
|
|
124
124
|
let container = _postcss.default.root({
|
|
125
125
|
nodes: [
|
|
126
|
-
|
|
126
|
+
rule1.clone()
|
|
127
127
|
]
|
|
128
128
|
});
|
|
129
129
|
for (let [variantSort, variantFunction] of variantFunctionTuples){
|
|
@@ -353,9 +353,9 @@ function* resolveMatches(candidate, context) {
|
|
|
353
353
|
// Only keep the result of the very first plugin if we are dealing with
|
|
354
354
|
// arbitrary values, to protect against ambiguity.
|
|
355
355
|
if (isArbitraryValue(modifier) && matches.length > 1) {
|
|
356
|
-
var
|
|
356
|
+
var ref1;
|
|
357
357
|
let typesPerPlugin = matches.map((match)=>new Set([
|
|
358
|
-
...(
|
|
358
|
+
...(ref1 = typesByMatches.get(match)) !== null && ref1 !== void 0 ? ref1 : []
|
|
359
359
|
])
|
|
360
360
|
);
|
|
361
361
|
// Remove duplicates, so that we can detect proper unique types for each plugin.
|
|
@@ -400,13 +400,13 @@ function* resolveMatches(candidate, context) {
|
|
|
400
400
|
for (let variant of variants){
|
|
401
401
|
matches = applyVariant(variant, matches, context);
|
|
402
402
|
}
|
|
403
|
-
for (let
|
|
403
|
+
for (let match1 of matches){
|
|
404
404
|
// Apply final format selector
|
|
405
|
-
if (
|
|
406
|
-
let finalFormat = (0, _formatVariantSelector).formatVariantSelector('&', ...
|
|
405
|
+
if (match1[0].collectedFormats) {
|
|
406
|
+
let finalFormat = (0, _formatVariantSelector).formatVariantSelector('&', ...match1[0].collectedFormats);
|
|
407
407
|
let container = _postcss.default.root({
|
|
408
408
|
nodes: [
|
|
409
|
-
|
|
409
|
+
match1[1].clone()
|
|
410
410
|
]
|
|
411
411
|
});
|
|
412
412
|
container.walkRules((rule)=>{
|
|
@@ -417,9 +417,9 @@ function* resolveMatches(candidate, context) {
|
|
|
417
417
|
context
|
|
418
418
|
});
|
|
419
419
|
});
|
|
420
|
-
|
|
420
|
+
match1[1] = container.nodes[0];
|
|
421
421
|
}
|
|
422
|
-
yield
|
|
422
|
+
yield match1;
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
}
|
|
@@ -47,8 +47,8 @@ function minimumImpactSelector(nodes) {
|
|
|
47
47
|
let splitPointIdx = rest.findIndex((n)=>searchFor.has(n.type)
|
|
48
48
|
);
|
|
49
49
|
if (splitPointIdx === -1) return rest.reverse().join('').trim();
|
|
50
|
-
let
|
|
51
|
-
let bestNode = getNode[
|
|
50
|
+
let node1 = rest[splitPointIdx];
|
|
51
|
+
let bestNode = getNode[node1.type] ? getNode[node1.type](node1) : node1;
|
|
52
52
|
rest = rest.slice(0, splitPointIdx);
|
|
53
53
|
let combinatorIdx = rest.findIndex((n)=>n.type === 'combinator' && n.value === '>'
|
|
54
54
|
);
|
|
@@ -258,7 +258,7 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
258
258
|
return ({ format })=>format(str)
|
|
259
259
|
;
|
|
260
260
|
}
|
|
261
|
-
let [, name, params] = /@(.*?) (
|
|
261
|
+
let [, name, params] = /@(.*?) (.*)/g.exec(str);
|
|
262
262
|
return ({ wrap })=>wrap(_postcss.default.atRule({
|
|
263
263
|
name,
|
|
264
264
|
params
|
|
@@ -607,6 +607,7 @@ function resolvePlugins(context, root) {
|
|
|
607
607
|
_corePlugins.variantPlugins['directionVariants'],
|
|
608
608
|
_corePlugins.variantPlugins['reducedMotionVariants'],
|
|
609
609
|
_corePlugins.variantPlugins['darkVariants'],
|
|
610
|
+
_corePlugins.variantPlugins['printVariant'],
|
|
610
611
|
_corePlugins.variantPlugins['screenVariants'],
|
|
611
612
|
];
|
|
612
613
|
return [
|
|
@@ -673,9 +674,9 @@ function registerPlugins(plugins, context) {
|
|
|
673
674
|
...context.variantOrder.values()
|
|
674
675
|
].shift();
|
|
675
676
|
// Build variantMap
|
|
676
|
-
for (let [variantName,
|
|
677
|
+
for (let [variantName, variantFunctions1] of variantMap.entries()){
|
|
677
678
|
let sort = context.variantOrder.get(variantName);
|
|
678
|
-
context.variantMap.set(variantName,
|
|
679
|
+
context.variantMap.set(variantName, variantFunctions1.map((variantFunction, idx)=>[
|
|
679
680
|
sort << BigInt(idx),
|
|
680
681
|
variantFunction
|
|
681
682
|
]
|
|
@@ -685,22 +686,22 @@ function registerPlugins(plugins, context) {
|
|
|
685
686
|
let safelist = ((_safelist = context.tailwindConfig.safelist) !== null && _safelist !== void 0 ? _safelist : []).filter(Boolean);
|
|
686
687
|
if (safelist.length > 0) {
|
|
687
688
|
let checks = [];
|
|
688
|
-
for (let
|
|
689
|
-
if (typeof
|
|
689
|
+
for (let value1 of safelist){
|
|
690
|
+
if (typeof value1 === 'string') {
|
|
690
691
|
context.changedContent.push({
|
|
691
|
-
content:
|
|
692
|
+
content: value1,
|
|
692
693
|
extension: 'html'
|
|
693
694
|
});
|
|
694
695
|
continue;
|
|
695
696
|
}
|
|
696
|
-
if (
|
|
697
|
+
if (value1 instanceof RegExp) {
|
|
697
698
|
_log.default.warn('root-regex', [
|
|
698
699
|
'Regular expressions in `safelist` work differently in Tailwind CSS v3.0.',
|
|
699
700
|
'Update your `safelist` configuration to eliminate this warning.'
|
|
700
701
|
]);
|
|
701
702
|
continue;
|
|
702
703
|
}
|
|
703
|
-
checks.push(
|
|
704
|
+
checks.push(value1);
|
|
704
705
|
}
|
|
705
706
|
if (checks.length > 0) {
|
|
706
707
|
let patternMatchingCount = new Map();
|
package/lib/lib/sharedState.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.contextSourcesMap = exports.configContextMap = exports.
|
|
5
|
+
exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
|
|
6
6
|
const env = {
|
|
7
7
|
TAILWIND_MODE: process.env.TAILWIND_MODE,
|
|
8
8
|
NODE_ENV: process.env.NODE_ENV,
|
|
9
|
-
DEBUG: process.env.DEBUG !== undefined,
|
|
9
|
+
DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== '0',
|
|
10
10
|
TAILWIND_DISABLE_TOUCH: process.env.TAILWIND_DISABLE_TOUCH !== undefined,
|
|
11
11
|
TAILWIND_TOUCH_DIR: process.env.TAILWIND_TOUCH_DIR
|
|
12
12
|
};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = _default;
|
|
6
|
+
var _normalizeScreens = require("../util/normalizeScreens");
|
|
6
7
|
var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
|
|
7
8
|
function _interopRequireDefault(obj) {
|
|
8
9
|
return obj && obj.__esModule ? obj : {
|
|
@@ -12,13 +13,15 @@ function _interopRequireDefault(obj) {
|
|
|
12
13
|
function _default({ tailwindConfig: { theme } }) {
|
|
13
14
|
return function(css) {
|
|
14
15
|
css.walkAtRules('screen', (atRule)=>{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
let screen = atRule.params;
|
|
17
|
+
let screens = (0, _normalizeScreens).normalizeScreens(theme.screens);
|
|
18
|
+
let screenDefinition = screens.find(({ name })=>name === screen
|
|
19
|
+
);
|
|
20
|
+
if (!screenDefinition) {
|
|
18
21
|
throw atRule.error(`No \`${screen}\` screen found.`);
|
|
19
22
|
}
|
|
20
23
|
atRule.name = 'media';
|
|
21
|
-
atRule.params = (0, _buildMediaQuery).default(
|
|
24
|
+
atRule.params = (0, _buildMediaQuery).default(screenDefinition);
|
|
22
25
|
});
|
|
23
26
|
};
|
|
24
27
|
}
|
|
@@ -4,28 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.default = buildMediaQuery;
|
|
6
6
|
function buildMediaQuery(screens) {
|
|
7
|
-
|
|
8
|
-
screens
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return screen.raw;
|
|
21
|
-
}
|
|
22
|
-
return Object.entries(screen).map(([feature, value])=>{
|
|
23
|
-
var _feature;
|
|
24
|
-
feature = (_feature = ({
|
|
25
|
-
min: 'min-width',
|
|
26
|
-
max: 'max-width'
|
|
27
|
-
})[feature]) !== null && _feature !== void 0 ? _feature : feature;
|
|
28
|
-
return `(${feature}: ${value})`;
|
|
29
|
-
}).join(' and ');
|
|
30
|
-
}).join(', ');
|
|
7
|
+
screens = Array.isArray(screens) ? screens : [
|
|
8
|
+
screens
|
|
9
|
+
];
|
|
10
|
+
return screens.map((screen1)=>screen1.values.map((screen)=>{
|
|
11
|
+
if (screen.raw !== undefined) {
|
|
12
|
+
return screen.raw;
|
|
13
|
+
}
|
|
14
|
+
return [
|
|
15
|
+
screen.min && `(min-width: ${screen.min})`,
|
|
16
|
+
screen.max && `(max-width: ${screen.max})`,
|
|
17
|
+
].filter(Boolean).join(' and ');
|
|
18
|
+
})
|
|
19
|
+
).join(', ');
|
|
31
20
|
}
|
|
@@ -25,8 +25,8 @@ function createUtilityPlugin(themeKey, utilityVariations = [
|
|
|
25
25
|
utilityVariation
|
|
26
26
|
];
|
|
27
27
|
var ref;
|
|
28
|
-
matchUtilities(group.reduce((
|
|
29
|
-
return Object.assign(
|
|
28
|
+
matchUtilities(group.reduce((obj1, [classPrefix, properties])=>{
|
|
29
|
+
return Object.assign(obj1, {
|
|
30
30
|
[classPrefix]: (value)=>{
|
|
31
31
|
return properties.reduce((obj, name)=>{
|
|
32
32
|
if (Array.isArray(name)) {
|