tailwindcss 0.0.0-insiders.d6301bd → 0.0.0-insiders.e2d5f21
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 +39 -3
- package/lib/cli.js +60 -60
- package/lib/constants.js +1 -1
- package/lib/corePluginList.js +4 -0
- package/lib/corePlugins.js +157 -54
- package/lib/css/preflight.css +2 -1
- 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/expandTailwindAtRules.js +2 -0
- package/lib/lib/generateRules.js +46 -10
- package/lib/lib/resolveDefaultsAtRules.js +2 -2
- package/lib/lib/setupContextUtils.js +15 -72
- package/lib/lib/sharedState.js +1 -1
- 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 +23 -3
- package/lib/util/formatVariantSelector.js +93 -9
- package/lib/util/isValidArbitraryValue.js +64 -0
- package/lib/util/nameClass.js +1 -0
- 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/package.json +10 -10
- package/peers/index.js +3772 -3072
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +143 -61
- package/src/css/preflight.css +2 -1
- package/src/lib/detectNesting.js +22 -3
- package/src/lib/evaluateTailwindFunctions.js +5 -2
- package/src/lib/expandTailwindAtRules.js +2 -0
- package/src/lib/generateRules.js +34 -0
- package/src/lib/setupContextUtils.js +6 -58
- package/src/lib/substituteScreenAtRules.js +6 -3
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/dataTypes.js +19 -3
- package/src/util/formatVariantSelector.js +92 -1
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/nameClass.js +1 -1
- package/src/util/normalizeScreens.js +42 -0
- package/src/util/parseBoxShadowValue.js +71 -0
- package/src/util/pluginUtils.js +2 -0
- package/stubs/defaultConfig.stub.js +25 -9
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;
|
|
@@ -196,15 +199,18 @@ let variantPlugins = {
|
|
|
196
199
|
addVariant('print', '@media print');
|
|
197
200
|
},
|
|
198
201
|
screenVariants: ({ theme , addVariant })=>{
|
|
199
|
-
for(let screen
|
|
200
|
-
let
|
|
201
|
-
|
|
202
|
-
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}`);
|
|
203
205
|
}
|
|
206
|
+
},
|
|
207
|
+
orientationVariants: ({ addVariant })=>{
|
|
208
|
+
addVariant('portrait', '@media (orientation: portrait)');
|
|
209
|
+
addVariant('landscape', '@media (orientation: landscape)');
|
|
204
210
|
}
|
|
205
211
|
};
|
|
206
212
|
exports.variantPlugins = variantPlugins;
|
|
207
|
-
let
|
|
213
|
+
let corePlugins1 = {
|
|
208
214
|
preflight: ({ addBase })=>{
|
|
209
215
|
let preflightStyles = _postcss.default.parse(_fs.default.readFileSync(path.join(__dirname, './css/preflight.css'), 'utf8'));
|
|
210
216
|
addBase([
|
|
@@ -215,27 +221,11 @@ let corePlugins = {
|
|
|
215
221
|
]);
|
|
216
222
|
},
|
|
217
223
|
container: (()=>{
|
|
218
|
-
function extractMinWidths(breakpoints) {
|
|
219
|
-
return
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
min: breakpoints
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
if (!Array.isArray(breakpoints)) {
|
|
227
|
-
breakpoints = [
|
|
228
|
-
breakpoints
|
|
229
|
-
];
|
|
230
|
-
}
|
|
231
|
-
return breakpoints.filter((breakpoint)=>{
|
|
232
|
-
var ref;
|
|
233
|
-
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'));
|
|
234
|
-
}).map((breakpoint)=>{
|
|
235
|
-
var ref;
|
|
236
|
-
return (ref = breakpoint['min-width']) !== null && ref !== void 0 ? ref : breakpoint.min;
|
|
237
|
-
});
|
|
238
|
-
});
|
|
224
|
+
function extractMinWidths(breakpoints = []) {
|
|
225
|
+
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min
|
|
226
|
+
)
|
|
227
|
+
).filter((v)=>v !== undefined
|
|
228
|
+
);
|
|
239
229
|
}
|
|
240
230
|
function mapMinWidthsToPadding(minWidths, screens, paddings) {
|
|
241
231
|
if (typeof paddings === 'undefined') {
|
|
@@ -259,25 +249,25 @@ let corePlugins = {
|
|
|
259
249
|
});
|
|
260
250
|
}
|
|
261
251
|
for (let minWidth of minWidths){
|
|
262
|
-
for (let
|
|
263
|
-
let
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
252
|
+
for (let screen of screens){
|
|
253
|
+
for (let { min } of screen.values){
|
|
254
|
+
if (min === minWidth) {
|
|
255
|
+
mapping.push({
|
|
256
|
+
minWidth,
|
|
257
|
+
padding: paddings[screen.name]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
270
260
|
}
|
|
271
261
|
}
|
|
272
262
|
}
|
|
273
263
|
return mapping;
|
|
274
264
|
}
|
|
275
265
|
return function({ addComponents , theme }) {
|
|
276
|
-
let screens = theme('container.screens', theme('screens'));
|
|
266
|
+
let screens = (0, _normalizeScreens).normalizeScreens(theme('container.screens', theme('screens')));
|
|
277
267
|
let minWidths = extractMinWidths(screens);
|
|
278
268
|
let paddings = mapMinWidthsToPadding(minWidths, screens, theme('container.padding'));
|
|
279
269
|
let generatePaddingFor = (minWidth)=>{
|
|
280
|
-
let paddingConfig = paddings.find((padding)
|
|
270
|
+
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth
|
|
281
271
|
);
|
|
282
272
|
if (!paddingConfig) {
|
|
283
273
|
return {
|
|
@@ -921,7 +911,9 @@ let corePlugins = {
|
|
|
921
911
|
],
|
|
922
912
|
],
|
|
923
913
|
],
|
|
924
|
-
]
|
|
914
|
+
], {
|
|
915
|
+
supportsNegativeValues: true
|
|
916
|
+
}),
|
|
925
917
|
transform: ({ addBase , addUtilities })=>{
|
|
926
918
|
addBase({
|
|
927
919
|
'@defaults transform': {
|
|
@@ -989,8 +981,8 @@ let corePlugins = {
|
|
|
989
981
|
];
|
|
990
982
|
}));
|
|
991
983
|
matchUtilities({
|
|
992
|
-
animate: (
|
|
993
|
-
let animations = (0, _parseAnimationValue).default(
|
|
984
|
+
animate: (value1)=>{
|
|
985
|
+
let animations = (0, _parseAnimationValue).default(value1);
|
|
994
986
|
return [
|
|
995
987
|
...animations.flatMap((animation)=>keyframes[animation.name]
|
|
996
988
|
),
|
|
@@ -1009,7 +1001,15 @@ let corePlugins = {
|
|
|
1009
1001
|
});
|
|
1010
1002
|
},
|
|
1011
1003
|
cursor: (0, _createUtilityPlugin).default('cursor'),
|
|
1012
|
-
touchAction: ({ addUtilities })=>{
|
|
1004
|
+
touchAction: ({ addBase , addUtilities })=>{
|
|
1005
|
+
addBase({
|
|
1006
|
+
'@defaults touch-action': {
|
|
1007
|
+
'--tw-pan-x': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1008
|
+
'--tw-pan-y': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1009
|
+
'--tw-pinch-zoom': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1010
|
+
'--tw-touch-action': 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)'
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
1013
|
addUtilities({
|
|
1014
1014
|
'.touch-auto': {
|
|
1015
1015
|
'touch-action': 'auto'
|
|
@@ -1018,25 +1018,46 @@ let corePlugins = {
|
|
|
1018
1018
|
'touch-action': 'none'
|
|
1019
1019
|
},
|
|
1020
1020
|
'.touch-pan-x': {
|
|
1021
|
-
'touch-action':
|
|
1021
|
+
'@defaults touch-action': {
|
|
1022
|
+
},
|
|
1023
|
+
'--tw-pan-x': 'pan-x',
|
|
1024
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1022
1025
|
},
|
|
1023
1026
|
'.touch-pan-left': {
|
|
1024
|
-
'touch-action':
|
|
1027
|
+
'@defaults touch-action': {
|
|
1028
|
+
},
|
|
1029
|
+
'--tw-pan-x': 'pan-left',
|
|
1030
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1025
1031
|
},
|
|
1026
1032
|
'.touch-pan-right': {
|
|
1027
|
-
'touch-action':
|
|
1033
|
+
'@defaults touch-action': {
|
|
1034
|
+
},
|
|
1035
|
+
'--tw-pan-x': 'pan-right',
|
|
1036
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1028
1037
|
},
|
|
1029
1038
|
'.touch-pan-y': {
|
|
1030
|
-
'touch-action':
|
|
1039
|
+
'@defaults touch-action': {
|
|
1040
|
+
},
|
|
1041
|
+
'--tw-pan-y': 'pan-y',
|
|
1042
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1031
1043
|
},
|
|
1032
1044
|
'.touch-pan-up': {
|
|
1033
|
-
'touch-action':
|
|
1045
|
+
'@defaults touch-action': {
|
|
1046
|
+
},
|
|
1047
|
+
'--tw-pan-y': 'pan-up',
|
|
1048
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1034
1049
|
},
|
|
1035
1050
|
'.touch-pan-down': {
|
|
1036
|
-
'touch-action':
|
|
1051
|
+
'@defaults touch-action': {
|
|
1052
|
+
},
|
|
1053
|
+
'--tw-pan-y': 'pan-down',
|
|
1054
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1037
1055
|
},
|
|
1038
1056
|
'.touch-pinch-zoom': {
|
|
1039
|
-
'touch-action':
|
|
1057
|
+
'@defaults touch-action': {
|
|
1058
|
+
},
|
|
1059
|
+
'--tw-pinch-zoom': 'pinch-zoom',
|
|
1060
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1040
1061
|
},
|
|
1041
1062
|
'.touch-manipulation': {
|
|
1042
1063
|
'touch-action': 'manipulation'
|
|
@@ -2296,6 +2317,12 @@ let corePlugins = {
|
|
|
2296
2317
|
},
|
|
2297
2318
|
'.decoration-clone': {
|
|
2298
2319
|
'box-decoration-break': 'clone'
|
|
2320
|
+
},
|
|
2321
|
+
'.box-decoration-slice': {
|
|
2322
|
+
'box-decoration-break': 'slice'
|
|
2323
|
+
},
|
|
2324
|
+
'.box-decoration-clone': {
|
|
2325
|
+
'box-decoration-break': 'clone'
|
|
2299
2326
|
}
|
|
2300
2327
|
});
|
|
2301
2328
|
},
|
|
@@ -2767,6 +2794,9 @@ let corePlugins = {
|
|
|
2767
2794
|
'.underline': {
|
|
2768
2795
|
'text-decoration': 'underline'
|
|
2769
2796
|
},
|
|
2797
|
+
'.overline': {
|
|
2798
|
+
'text-decoration': 'overline'
|
|
2799
|
+
},
|
|
2770
2800
|
'.line-through': {
|
|
2771
2801
|
'text-decoration': 'line-through'
|
|
2772
2802
|
},
|
|
@@ -2785,11 +2815,55 @@ let corePlugins = {
|
|
|
2785
2815
|
}, {
|
|
2786
2816
|
values: (0, _flattenColorPalette).default(theme('textDecorationColor')),
|
|
2787
2817
|
type: [
|
|
2788
|
-
'color'
|
|
2789
|
-
'any'
|
|
2818
|
+
'color'
|
|
2790
2819
|
]
|
|
2791
2820
|
});
|
|
2792
2821
|
},
|
|
2822
|
+
textDecorationStyle: ({ addUtilities })=>{
|
|
2823
|
+
addUtilities({
|
|
2824
|
+
'.decoration-solid': {
|
|
2825
|
+
'text-decoration-style': 'solid'
|
|
2826
|
+
},
|
|
2827
|
+
'.decoration-double': {
|
|
2828
|
+
'text-decoration-style': 'double'
|
|
2829
|
+
},
|
|
2830
|
+
'.decoration-dotted': {
|
|
2831
|
+
'text-decoration-style': 'dotted'
|
|
2832
|
+
},
|
|
2833
|
+
'.decoration-dashed': {
|
|
2834
|
+
'text-decoration-style': 'dashed'
|
|
2835
|
+
},
|
|
2836
|
+
'.decoration-wavy': {
|
|
2837
|
+
'text-decoration-style': 'wavy'
|
|
2838
|
+
}
|
|
2839
|
+
});
|
|
2840
|
+
},
|
|
2841
|
+
textDecorationThickness: (0, _createUtilityPlugin).default('textDecorationThickness', [
|
|
2842
|
+
[
|
|
2843
|
+
'decoration',
|
|
2844
|
+
[
|
|
2845
|
+
'text-decoration-thickness'
|
|
2846
|
+
]
|
|
2847
|
+
]
|
|
2848
|
+
], {
|
|
2849
|
+
type: [
|
|
2850
|
+
'length',
|
|
2851
|
+
'percentage'
|
|
2852
|
+
]
|
|
2853
|
+
}),
|
|
2854
|
+
textUnderlineOffset: (0, _createUtilityPlugin).default('textUnderlineOffset', [
|
|
2855
|
+
[
|
|
2856
|
+
'underline-offset',
|
|
2857
|
+
[
|
|
2858
|
+
'text-underline-offset'
|
|
2859
|
+
]
|
|
2860
|
+
]
|
|
2861
|
+
], {
|
|
2862
|
+
type: [
|
|
2863
|
+
'length',
|
|
2864
|
+
'percentage'
|
|
2865
|
+
]
|
|
2866
|
+
}),
|
|
2793
2867
|
fontSmoothing: ({ addUtilities })=>{
|
|
2794
2868
|
addUtilities({
|
|
2795
2869
|
'.antialiased': {
|
|
@@ -2995,24 +3069,52 @@ let corePlugins = {
|
|
|
2995
3069
|
'@defaults box-shadow': {
|
|
2996
3070
|
'--tw-ring-offset-shadow': '0 0 #0000',
|
|
2997
3071
|
'--tw-ring-shadow': '0 0 #0000',
|
|
2998
|
-
'--tw-shadow': '0 0 #0000'
|
|
3072
|
+
'--tw-shadow': '0 0 #0000',
|
|
3073
|
+
'--tw-shadow-colored': '0 0 #0000'
|
|
2999
3074
|
}
|
|
3000
3075
|
});
|
|
3001
3076
|
matchUtilities({
|
|
3002
3077
|
shadow: (value)=>{
|
|
3003
3078
|
value = transformValue(value);
|
|
3079
|
+
let ast = (0, _parseBoxShadowValue).parseBoxShadowValue(value);
|
|
3080
|
+
for (let shadow of ast){
|
|
3081
|
+
// Don't override color if the whole shadow is a variable
|
|
3082
|
+
if (!shadow.valid) {
|
|
3083
|
+
continue;
|
|
3084
|
+
}
|
|
3085
|
+
shadow.color = 'var(--tw-shadow-color)';
|
|
3086
|
+
}
|
|
3004
3087
|
return {
|
|
3005
3088
|
'@defaults box-shadow': {
|
|
3006
3089
|
},
|
|
3007
3090
|
'--tw-shadow': value === 'none' ? '0 0 #0000' : value,
|
|
3091
|
+
'--tw-shadow-colored': value === 'none' ? '0 0 #0000' : (0, _parseBoxShadowValue).formatBoxShadowValue(ast),
|
|
3008
3092
|
'box-shadow': defaultBoxShadow
|
|
3009
3093
|
};
|
|
3010
3094
|
}
|
|
3011
3095
|
}, {
|
|
3012
|
-
values: theme('boxShadow')
|
|
3096
|
+
values: theme('boxShadow'),
|
|
3097
|
+
type: [
|
|
3098
|
+
'shadow'
|
|
3099
|
+
]
|
|
3013
3100
|
});
|
|
3014
3101
|
};
|
|
3015
3102
|
})(),
|
|
3103
|
+
boxShadowColor: ({ matchUtilities , theme })=>{
|
|
3104
|
+
matchUtilities({
|
|
3105
|
+
shadow: (value)=>{
|
|
3106
|
+
return {
|
|
3107
|
+
'--tw-shadow-color': (0, _toColorValue).default(value),
|
|
3108
|
+
'--tw-shadow': 'var(--tw-shadow-colored)'
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
}, {
|
|
3112
|
+
values: (0, _flattenColorPalette).default(theme('boxShadowColor')),
|
|
3113
|
+
type: [
|
|
3114
|
+
'color'
|
|
3115
|
+
]
|
|
3116
|
+
});
|
|
3117
|
+
},
|
|
3016
3118
|
outlineStyle: ({ addUtilities })=>{
|
|
3017
3119
|
addUtilities({
|
|
3018
3120
|
'.outline-none': {
|
|
@@ -3089,7 +3191,8 @@ let corePlugins = {
|
|
|
3089
3191
|
'--tw-ring-color': ringColorDefault,
|
|
3090
3192
|
'--tw-ring-offset-shadow': '0 0 #0000',
|
|
3091
3193
|
'--tw-ring-shadow': '0 0 #0000',
|
|
3092
|
-
'--tw-shadow': '0 0 #0000'
|
|
3194
|
+
'--tw-shadow': '0 0 #0000',
|
|
3195
|
+
'--tw-shadow-colored': '0 0 #0000'
|
|
3093
3196
|
}
|
|
3094
3197
|
});
|
|
3095
3198
|
matchUtilities({
|
|
@@ -3559,4 +3662,4 @@ let corePlugins = {
|
|
|
3559
3662
|
],
|
|
3560
3663
|
])
|
|
3561
3664
|
};
|
|
3562
|
-
exports.corePlugins =
|
|
3665
|
+
exports.corePlugins = corePlugins1;
|
package/lib/css/preflight.css
CHANGED
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
|
}
|
|
@@ -46,6 +46,8 @@ const PATTERNS = [
|
|
|
46
46
|
/([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
|
|
47
47
|
/([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
|
|
48
48
|
/([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
|
|
49
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source,
|
|
50
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source,
|
|
49
51
|
/([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source,
|
|
50
52
|
/([^<>"'`\s]*[^"'`\s:])/.source
|
|
51
53
|
].join('|');
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -11,6 +11,9 @@ var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
|
|
|
11
11
|
var _pluginUtils = require("../util/pluginUtils");
|
|
12
12
|
var _log = _interopRequireDefault(require("../util/log"));
|
|
13
13
|
var _formatVariantSelector = require("../util/formatVariantSelector");
|
|
14
|
+
var _nameClass = require("../util/nameClass");
|
|
15
|
+
var _dataTypes = require("../util/dataTypes");
|
|
16
|
+
var _isValidArbitraryValue = _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
|
14
17
|
function _interopRequireDefault(obj) {
|
|
15
18
|
return obj && obj.__esModule ? obj : {
|
|
16
19
|
default: obj
|
|
@@ -120,10 +123,10 @@ function applyVariant(variant, matches, context) {
|
|
|
120
123
|
if (context.variantMap.has(variant)) {
|
|
121
124
|
let variantFunctionTuples = context.variantMap.get(variant);
|
|
122
125
|
let result = [];
|
|
123
|
-
for (let [meta,
|
|
126
|
+
for (let [meta, rule1] of matches){
|
|
124
127
|
let container = _postcss.default.root({
|
|
125
128
|
nodes: [
|
|
126
|
-
|
|
129
|
+
rule1.clone()
|
|
127
130
|
]
|
|
128
131
|
});
|
|
129
132
|
for (let [variantSort, variantFunction] of variantFunctionTuples){
|
|
@@ -250,6 +253,31 @@ function parseRules(rule, cache, options = {
|
|
|
250
253
|
options
|
|
251
254
|
];
|
|
252
255
|
}
|
|
256
|
+
function extractArbitraryProperty(classCandidate, context) {
|
|
257
|
+
var ref;
|
|
258
|
+
let [, property, value] = (ref = classCandidate.match(/^\[([a-zA-Z0-9-_]+):(\S+)\]$/)) !== null && ref !== void 0 ? ref : [];
|
|
259
|
+
if (value === undefined) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
let normalized = (0, _dataTypes).normalize(value);
|
|
263
|
+
if (!(0, _isValidArbitraryValue).default(normalized)) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
return [
|
|
267
|
+
[
|
|
268
|
+
{
|
|
269
|
+
sort: context.arbitraryPropertiesSort,
|
|
270
|
+
layer: 'utilities'
|
|
271
|
+
},
|
|
272
|
+
()=>({
|
|
273
|
+
[(0, _nameClass).asClass(classCandidate)]: {
|
|
274
|
+
[property]: normalized
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
,
|
|
278
|
+
],
|
|
279
|
+
];
|
|
280
|
+
}
|
|
253
281
|
function* resolveMatchedPlugins(classCandidate, context) {
|
|
254
282
|
if (context.candidateRuleMap.has(classCandidate)) {
|
|
255
283
|
yield [
|
|
@@ -257,6 +285,14 @@ function* resolveMatchedPlugins(classCandidate, context) {
|
|
|
257
285
|
'DEFAULT'
|
|
258
286
|
];
|
|
259
287
|
}
|
|
288
|
+
yield* (function*(arbitraryPropertyRule) {
|
|
289
|
+
if (arbitraryPropertyRule !== null) {
|
|
290
|
+
yield [
|
|
291
|
+
arbitraryPropertyRule,
|
|
292
|
+
'DEFAULT'
|
|
293
|
+
];
|
|
294
|
+
}
|
|
295
|
+
})(extractArbitraryProperty(classCandidate, context));
|
|
260
296
|
let candidatePrefix = classCandidate;
|
|
261
297
|
let negative = false;
|
|
262
298
|
const twConfigPrefix = context.tailwindConfig.prefix;
|
|
@@ -353,9 +389,9 @@ function* resolveMatches(candidate, context) {
|
|
|
353
389
|
// Only keep the result of the very first plugin if we are dealing with
|
|
354
390
|
// arbitrary values, to protect against ambiguity.
|
|
355
391
|
if (isArbitraryValue(modifier) && matches.length > 1) {
|
|
356
|
-
var
|
|
392
|
+
var ref1;
|
|
357
393
|
let typesPerPlugin = matches.map((match)=>new Set([
|
|
358
|
-
...(
|
|
394
|
+
...(ref1 = typesByMatches.get(match)) !== null && ref1 !== void 0 ? ref1 : []
|
|
359
395
|
])
|
|
360
396
|
);
|
|
361
397
|
// Remove duplicates, so that we can detect proper unique types for each plugin.
|
|
@@ -400,13 +436,13 @@ function* resolveMatches(candidate, context) {
|
|
|
400
436
|
for (let variant of variants){
|
|
401
437
|
matches = applyVariant(variant, matches, context);
|
|
402
438
|
}
|
|
403
|
-
for (let
|
|
439
|
+
for (let match1 of matches){
|
|
404
440
|
// Apply final format selector
|
|
405
|
-
if (
|
|
406
|
-
let finalFormat = (0, _formatVariantSelector).formatVariantSelector('&', ...
|
|
441
|
+
if (match1[0].collectedFormats) {
|
|
442
|
+
let finalFormat = (0, _formatVariantSelector).formatVariantSelector('&', ...match1[0].collectedFormats);
|
|
407
443
|
let container = _postcss.default.root({
|
|
408
444
|
nodes: [
|
|
409
|
-
|
|
445
|
+
match1[1].clone()
|
|
410
446
|
]
|
|
411
447
|
});
|
|
412
448
|
container.walkRules((rule)=>{
|
|
@@ -417,9 +453,9 @@ function* resolveMatches(candidate, context) {
|
|
|
417
453
|
context
|
|
418
454
|
});
|
|
419
455
|
});
|
|
420
|
-
|
|
456
|
+
match1[1] = container.nodes[0];
|
|
421
457
|
}
|
|
422
|
-
yield
|
|
458
|
+
yield match1;
|
|
423
459
|
}
|
|
424
460
|
}
|
|
425
461
|
}
|
|
@@ -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
|
);
|