tailwindcss 0.0.0-insiders.c25fbc7 → 0.0.0-insiders.c48e629
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 +27 -1
- package/lib/corePluginList.js +4 -0
- package/lib/corePlugins.js +152 -49
- package/lib/css/preflight.css +2 -1
- package/lib/lib/detectNesting.js +17 -2
- package/lib/lib/evaluateTailwindFunctions.js +6 -2
- package/lib/lib/expandTailwindAtRules.js +2 -0
- package/lib/lib/generateRules.js +36 -0
- package/lib/lib/setupContextUtils.js +8 -65
- package/lib/lib/substituteScreenAtRules.js +7 -4
- package/lib/util/buildMediaQuery.js +13 -24
- package/lib/util/dataTypes.js +23 -3
- package/lib/util/formatVariantSelector.js +88 -4
- package/lib/util/isValidArbitraryValue.js +64 -0
- package/lib/util/nameClass.js +1 -0
- package/lib/util/normalizeScreens.js +58 -0
- package/lib/util/parseBoxShadowValue.js +77 -0
- package/lib/util/pluginUtils.js +2 -1
- package/package.json +8 -8
- package/peers/index.js +3713 -3001
- 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 +23 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Enforce the order of some variants (like `before` and `after`) ([#6018](https://github.com/tailwindlabs/tailwindcss/pull/6018))
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Add `placeholder` variant ([#6106](https://github.com/tailwindlabs/tailwindcss/pull/6106))
|
|
17
|
+
- Add tuple syntax for configuring screens while guaranteeing order ([#5956](https://github.com/tailwindlabs/tailwindcss/pull/5956))
|
|
18
|
+
- Add combinable `touch-action` support ([#6115](https://github.com/tailwindlabs/tailwindcss/pull/6115))
|
|
19
|
+
- Add support for "arbitrary properties" ([#6161](https://github.com/tailwindlabs/tailwindcss/pull/6161))
|
|
20
|
+
- Add `portrait` and `landscape` variants ([#6046](https://github.com/tailwindlabs/tailwindcss/pull/6046))
|
|
21
|
+
- Add `text-decoration-style`, `text-decoration-thickness`, and `text-underline-offset` utilities ([#6004](https://github.com/tailwindlabs/tailwindcss/pull/6004))
|
|
22
|
+
- Add `menu` reset to preflight ([#6213](https://github.com/tailwindlabs/tailwindcss/pull/6213))
|
|
23
|
+
- Allow `0` as a valid `length` value ([#6233](https://github.com/tailwindlabs/tailwindcss/pull/6233), [#6259](https://github.com/tailwindlabs/tailwindcss/pull/6259))
|
|
24
|
+
- Add css functions to data types ([#6258](https://github.com/tailwindlabs/tailwindcss/pull/6258))
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- Deprecate `decoration-slice` and `decoration-break` in favor `box-decoration-slice` and `box-decoration-break` _(non-breaking)_ ([#6004](https://github.com/tailwindlabs/tailwindcss/pull/6004))
|
|
29
|
+
|
|
30
|
+
## [3.0.0-alpha.2] - 2021-11-08
|
|
31
|
+
|
|
10
32
|
### Changed
|
|
11
33
|
|
|
12
34
|
- Don't use pointer cursor on disabled buttons by default ([#5772](https://github.com/tailwindlabs/tailwindcss/pull/5772))
|
|
@@ -23,7 +45,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
23
45
|
- Add `grow-*` and `shrink-*` utilities, deprecate `flex-grow-*` and `flex-shrink-*` ([#5733](https://github.com/tailwindlabs/tailwindcss/pull/5733))
|
|
24
46
|
- Add `text-decoration-color` utilities ([#5760](https://github.com/tailwindlabs/tailwindcss/pull/5760))
|
|
25
47
|
- Add new declarative `addVariant` API ([#5809](https://github.com/tailwindlabs/tailwindcss/pull/5809))
|
|
48
|
+
- Add first-class `print` variant for targeting printed media ([#5885](https://github.com/tailwindlabs/tailwindcss/pull/5885))
|
|
26
49
|
- Add full color palette for `fill-*` and `stroke-*` utilities (#5933[](https://github.com/tailwindlabs/tailwindcss/pull/5933))
|
|
50
|
+
- Add composable API for colored box shadows ([#5979](https://github.com/tailwindlabs/tailwindcss/pull/5979))
|
|
27
51
|
|
|
28
52
|
### Fixed
|
|
29
53
|
|
|
@@ -34,6 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
34
58
|
- Allow `_` inside `url()` when using arbitrary values ([#5853](https://github.com/tailwindlabs/tailwindcss/pull/5853))
|
|
35
59
|
- Prevent crashes when using comments in `@layer` AtRules ([#5854](https://github.com/tailwindlabs/tailwindcss/pull/5854))
|
|
36
60
|
- Handle color transformations properly with `theme(...)` for all relevant plugins ([#4533](https://github.com/tailwindlabs/tailwindcss/pull/4533), [#5871](https://github.com/tailwindlabs/tailwindcss/pull/5871))
|
|
61
|
+
- Ensure `@apply`-ing a utility with multiple definitions works ([#5870](https://github.com/tailwindlabs/tailwindcss/pull/5870))
|
|
37
62
|
|
|
38
63
|
## [3.0.0-alpha.1] - 2021-10-01
|
|
39
64
|
|
|
@@ -1650,7 +1675,8 @@ No release notes
|
|
|
1650
1675
|
|
|
1651
1676
|
- Everything!
|
|
1652
1677
|
|
|
1653
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.
|
|
1678
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.2...HEAD
|
|
1679
|
+
[3.0.0-alpha.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.1...v3.0.0-alpha.2
|
|
1654
1680
|
[3.0.0-alpha.1]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.19...v3.0.0-alpha.1
|
|
1655
1681
|
[2.2.19]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.18...v2.2.19
|
|
1656
1682
|
[2.2.18]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.17...v2.2.18
|
package/lib/corePluginList.js
CHANGED
|
@@ -126,6 +126,9 @@ var _default = [
|
|
|
126
126
|
"textOpacity",
|
|
127
127
|
"textDecoration",
|
|
128
128
|
"textDecorationColor",
|
|
129
|
+
"textDecorationStyle",
|
|
130
|
+
"textDecorationThickness",
|
|
131
|
+
"textUnderlineOffset",
|
|
129
132
|
"fontSmoothing",
|
|
130
133
|
"placeholderColor",
|
|
131
134
|
"placeholderOpacity",
|
|
@@ -135,6 +138,7 @@ var _default = [
|
|
|
135
138
|
"backgroundBlendMode",
|
|
136
139
|
"mixBlendMode",
|
|
137
140
|
"boxShadow",
|
|
141
|
+
"boxShadowColor",
|
|
138
142
|
"outlineStyle",
|
|
139
143
|
"outlineWidth",
|
|
140
144
|
"outlineOffset",
|
package/lib/corePlugins.js
CHANGED
|
@@ -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,11 +199,14 @@ 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;
|
|
@@ -215,27 +221,11 @@ let corePlugins1 = {
|
|
|
215
221
|
]);
|
|
216
222
|
},
|
|
217
223
|
container: (()=>{
|
|
218
|
-
function extractMinWidths(
|
|
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 corePlugins1 = {
|
|
|
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 corePlugins1 = {
|
|
|
921
911
|
],
|
|
922
912
|
],
|
|
923
913
|
],
|
|
924
|
-
]
|
|
914
|
+
], {
|
|
915
|
+
supportsNegativeValues: true
|
|
916
|
+
}),
|
|
925
917
|
transform: ({ addBase , addUtilities })=>{
|
|
926
918
|
addBase({
|
|
927
919
|
'@defaults transform': {
|
|
@@ -1009,7 +1001,15 @@ let corePlugins1 = {
|
|
|
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 corePlugins1 = {
|
|
|
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 corePlugins1 = {
|
|
|
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 corePlugins1 = {
|
|
|
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 corePlugins1 = {
|
|
|
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 corePlugins1 = {
|
|
|
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 corePlugins1 = {
|
|
|
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({
|
package/lib/css/preflight.css
CHANGED
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) {
|
|
@@ -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)=>{
|
|
@@ -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
|
|
@@ -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;
|
|
@@ -23,6 +23,7 @@ var sharedState = _interopRequireWildcard(require("./sharedState"));
|
|
|
23
23
|
var _toPath = require("../util/toPath");
|
|
24
24
|
var _log = _interopRequireDefault(require("../util/log"));
|
|
25
25
|
var _negateValue = _interopRequireDefault(require("../util/negateValue"));
|
|
26
|
+
var _isValidArbitraryValue = _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
|
26
27
|
function _interopRequireDefault(obj) {
|
|
27
28
|
return obj && obj.__esModule ? obj : {
|
|
28
29
|
default: obj
|
|
@@ -160,68 +161,6 @@ function withIdentifiers(styles) {
|
|
|
160
161
|
});
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
|
-
let matchingBrackets = new Map([
|
|
164
|
-
[
|
|
165
|
-
'{',
|
|
166
|
-
'}'
|
|
167
|
-
],
|
|
168
|
-
[
|
|
169
|
-
'[',
|
|
170
|
-
']'
|
|
171
|
-
],
|
|
172
|
-
[
|
|
173
|
-
'(',
|
|
174
|
-
')'
|
|
175
|
-
],
|
|
176
|
-
]);
|
|
177
|
-
let inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v])=>[
|
|
178
|
-
v,
|
|
179
|
-
k
|
|
180
|
-
]
|
|
181
|
-
));
|
|
182
|
-
let quotes = new Set([
|
|
183
|
-
'"',
|
|
184
|
-
"'",
|
|
185
|
-
'`'
|
|
186
|
-
]);
|
|
187
|
-
// Arbitrary values must contain balanced brackets (), [] and {}. Escaped
|
|
188
|
-
// values don't count, and brackets inside quotes also don't count.
|
|
189
|
-
//
|
|
190
|
-
// E.g.: w-[this-is]w-[weird-and-invalid]
|
|
191
|
-
// E.g.: w-[this-is\\]w-\\[weird-but-valid]
|
|
192
|
-
// E.g.: content-['this-is-also-valid]-weirdly-enough']
|
|
193
|
-
function isValidArbitraryValue(value) {
|
|
194
|
-
let stack = [];
|
|
195
|
-
let inQuotes = false;
|
|
196
|
-
for(let i = 0; i < value.length; i++){
|
|
197
|
-
let char = value[i];
|
|
198
|
-
// Non-escaped quotes allow us to "allow" anything in between
|
|
199
|
-
if (quotes.has(char) && value[i - 1] !== '\\') {
|
|
200
|
-
inQuotes = !inQuotes;
|
|
201
|
-
}
|
|
202
|
-
if (inQuotes) continue;
|
|
203
|
-
if (value[i - 1] === '\\') continue; // Escaped
|
|
204
|
-
if (matchingBrackets.has(char)) {
|
|
205
|
-
stack.push(char);
|
|
206
|
-
} else if (inverseMatchingBrackets.has(char)) {
|
|
207
|
-
let inverse = inverseMatchingBrackets.get(char);
|
|
208
|
-
// Nothing to pop from, therefore it is unbalanced
|
|
209
|
-
if (stack.length <= 0) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
// Popped value must match the inverse value, otherwise it is unbalanced
|
|
213
|
-
if (stack.pop() !== inverse) {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
// If there is still something on the stack, it is also unbalanced
|
|
219
|
-
if (stack.length > 0) {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
// All good, totally balanced!
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
164
|
function buildPluginApi(tailwindConfig, context, { variantList , variantMap , offsets , classList }) {
|
|
226
165
|
function getConfigValue(path, defaultValue) {
|
|
227
166
|
return path ? (0, _dlv).default(tailwindConfig, path, defaultValue) : tailwindConfig;
|
|
@@ -409,7 +348,7 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
409
348
|
if (!type.includes(coercedType) && !isOnlyPlugin) {
|
|
410
349
|
return [];
|
|
411
350
|
}
|
|
412
|
-
if (!
|
|
351
|
+
if (!(0, _isValidArbitraryValue).default(value)) {
|
|
413
352
|
return [];
|
|
414
353
|
}
|
|
415
354
|
let ruleSets = [].concat(rule(value)).filter(Boolean).map((declaration)=>({
|
|
@@ -466,7 +405,7 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
466
405
|
return [];
|
|
467
406
|
}
|
|
468
407
|
}
|
|
469
|
-
if (!
|
|
408
|
+
if (!(0, _isValidArbitraryValue).default(value)) {
|
|
470
409
|
return [];
|
|
471
410
|
}
|
|
472
411
|
let ruleSets = [].concat(rule(value)).filter(Boolean).map((declaration)=>({
|
|
@@ -608,7 +547,8 @@ function resolvePlugins(context, root) {
|
|
|
608
547
|
_corePlugins.variantPlugins['reducedMotionVariants'],
|
|
609
548
|
_corePlugins.variantPlugins['darkVariants'],
|
|
610
549
|
_corePlugins.variantPlugins['printVariant'],
|
|
611
|
-
_corePlugins.variantPlugins['screenVariants'],
|
|
550
|
+
_corePlugins.variantPlugins['screenVariants'],
|
|
551
|
+
_corePlugins.variantPlugins['orientationVariants'],
|
|
612
552
|
];
|
|
613
553
|
return [
|
|
614
554
|
...corePluginList,
|
|
@@ -652,6 +592,9 @@ function registerPlugins(plugins, context) {
|
|
|
652
592
|
offsets.user,
|
|
653
593
|
]);
|
|
654
594
|
let reservedBits = BigInt(highestOffset.toString(2).length);
|
|
595
|
+
// A number one less than the top range of the highest offset area
|
|
596
|
+
// so arbitrary properties are always sorted at the end.
|
|
597
|
+
context.arbitraryPropertiesSort = (1n << reservedBits << 0n) - 1n;
|
|
655
598
|
context.layerOrder = {
|
|
656
599
|
base: 1n << reservedBits << 0n,
|
|
657
600
|
components: 1n << reservedBits << 1n,
|